all groups > sql server connect > may 2006 >
You're in the

sql server connect

group:

Connection String for SQL 2005 Express


Connection String for SQL 2005 Express Macca
5/22/2006 7:42:02 AM
sql server connect:
Hi,

My C# app uses SQL Server 2005 Express edition.

I store my connection string in a config file.

My application will run on numerous machines and therefore the machine name
will be different each time. What I would like is a generic connection string
so that I don't have to change it each time I install my app on a different
machine.

I therefore want to avoid specifing the machine name in the connection
string as shown below :-

"Data Source=MachineName;Initial Catalog=pubs;Integrated Security=SSPI;"

Is there any way to make this connection string generic so that it can stay
the same between different machines?

Thanks
Re: Connection String for SQL 2005 Express Roger Wolter[MSFT]
5/22/2006 7:22:06 PM
If you run your application on the same machine as the database, . (period)
works as a server name. So if your install SQL Express with the default
instance name, the server name is .\SQLEXPRESS
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

AddThis Social Bookmark Button