Search code examples
connection-stringssmssql-server-expresssetup-deployment

How to make a connection string for sql server 2005 with a instance that works for all default sql express default instance?


I have built my database in SQL Server 2005 Management Studio and in deployment on my C#.NET application I have added SQL Server Express Edition with the application ..

I was using connection string

server=My-PC\\SA;database=My_database;uid=sa;pwd=sql;"

Now on deployment it gives error of instance. So how to make a connection string defaultly that works for both SQL Server 2005 Management Studio and SQL Server Express Edition?


Solution

  • Hopefully this should work,

    Server = .\SQLEXPRESS; Integrated Security=SSPI