This works oSQLConn.ConnectionString = "Data Source=(local);" & _ "Initial Catalog=Pubs;" & _ "Integrated Security=SSPI" oSQLConn.Open()
-----Original Message----- From: Jason Bunting [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 04, 2004 14:34 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Server-Independent Connection String > > Under ODBC, I can specify a database connection string in a > > server-agnostic fashion. For example: > > > > "DRIVER={SQL > > Server};SERVER=(local);DATABASE=MCSCRE;Trusted_Connection=Yes" > > > > Under .Net, I am thus far using a server-dependent connection > > string as the above does not work: > > > > SqlConnection con = new SqlConnection("data > > source=MACHINE2;initial catalog=MCSCRE;integrated > > security=SSPI;persist security info=False;workstation > > id=MACHINE2;packet size=4096"); > > > How can I make the latter server-agnostic? > > I'm afraid you can't do that. Oh, you can't? I think have done that before. You do something like this: "Data Source=127.0.0.1,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;" And that way if someone moves that project to a different box (assuming settings are the same) the connection string does not need to be changed. Maybe I am wrong, but I swear I have done this before. Jason =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet View archives and manage your subscription(s) at http://discuss.develop.com