Hello all,
I develop on two or three different machines at different times. I need
a connection string in my app that will always reference the local
instance (for whatever machine) of Microsoft SQL Server 2005. I have
found that the following will work, but I have to change the machine
name as I code on each box...
"server=MACHINENAME;database=MYDATABASE;uid=sa;pas sword=[somepassword];"
I know that I should be able to use a generic reference instead of the
actual machine name, as I used to do with SQL 2000, but it doesn't work
anymore now. I have tried...
"server=local;database=MYDATABASE;uid=sa;passw ord=[somepassword];"
"server=(local);database=MYDATABASE;uid=sa;passwor d=[somepassword];"
"server=localhost;database=MYDATABASE;uid=sa;passw ord=[somepassword];"
"server=(localhost);database=MYDATABASE;uid=sa;pas sword=[somepassword];"
....but the app times out and says "System.Data.SqlClient.SqlException:
SQL Server does not exist or access denied."
I also tried...
"server=127.0.0.1;database=MYDATABASE;uid=sa;passw ord=[somepassword];"
....but then it times out and says "System.Data.SqlClient.SqlException:
General network error. Check your network documentation."
I installed Microsoft SQL Server 2005 Developer edition on these boxes.
I installed all of the default settings and did not create special
instance names or anything. Also, the server name (local) works fine
when logging into SQL Server Management Studio.
Any suggestions?