I have SQL Server Express 2008 installed on one of my machines and I'm trying to establish a remote connection ... when I use MS SQL Server Management Studio, I can log into the database (with the same credentials) without problems, but when I try to create a connection string in my C # application, I get an exception:
A network or specific instance error occurred while creating a connection to SQL Server. The server was not found or was unavailable. Verify that the instance name is correct and that SQL Server is configured for a remote connection.
Here's what my connection string looks like (personal info changed):
"Data Source="MACHINENAME\\SQLEXPRESS";User ID="Admin";Password="the_password";Initial Catalog="MyDatabase";Integrated Security=True;Connect Timeout=120");
As I said, I can log in using Studio Management with the same settings : the same user ID, password and data source name, but it does not work when I try to open a connection with the above connection string.
Note:
I turned on remote communication on the server, turned off the firewall, connected TCP / IP to the server, turned on the SQL browser.
The connection string works fine when I'm on the same machine.
I looked at the Integrated Security parameter and I set it to false to make sure it is not trying to use Windows login, but it still does not work.
The database is configured to allow login and login to the system.
I change the Integrated Security parameter to SSPI, True and finally False, all 3 gave me the same error as above.
- , - ?
UPDATE, ( , , ):
string _connectionString =
//string.Format("Server=%s;User ID=%s;Password=%s;Database=%s;Connect Timeout=120", // Same problem
//string.Format("Server=%s;User ID=%s;Password=%s;Database=%s;Integrated Security=False;Connect Timeout=120", // Same problem
string.Format("Data Source=%s;User ID=%s;Password=%s;Initial Catalog=%s;Integrated Security=False;Connect Timeout=120", // Same problem
"GANTCHEVI\\SQLEXPRESS",
"FinchAdmin",
"the_password",
"Finch");
Connected Management Studio: . http://s113.photobucket.com/albums/n202/ozpowermo/?action=view¤t=ManagementStudio.jpg
http://s113.photobucket.com/albums/n202/ozpowermo/?action=view¤t=ManagementStudio.jpg
:
" =" " ", User ID, , !
string _connectionString = "Data Source=GANTCHEVI\\SQLEXPRESS;Initial Catalog=Finch;Integrated Security=False;User Id=FinchAdmin;Password=the_password;Connect Timeout=0";"