Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have made an application on my own computer, and at the time of creation there were no problems at all.

I runned this connection string on my local computer, and it worked perfectly.

private SqlConnection connection = new SqlConnection("Data Source=LT004512\\SQLEXPRESS;Initial Catalog=databasename;Integrated Security=SSPI;");


However, when i edited the connection string to the following (becouse it had to run on an other computer), my program didn't start.
private SqlConnection connection = new SqlConnection("Data Source=VG-VJGZTEST\\SQLEXPRESS;Initial Catalog=databasename;Integrated Security=SSPI;");


No big deal i thought at first, but it also didn't work at the cliënt server.

For some reason, it only worked at the local host, and it looks like it can't get a connection.

Does anyone know what steps i have to take to counter this problem.
Posted

I'm guessing you haven't enabled TCP/IP in SQL Server Network Configuration on the server.

SQL Server Network Configuration is found using Microsoft SQL Server 2008 -> Configuration Tools -> Sql Server Configuration Manager
 
Share this answer
 
v2
Comments
Kim Togo 6-Apr-11 9:52am    
I think you are right. See my answer.
hey mate,
as u said it should work properly..
may be the problem is in other computer's database..
check it once again properly..
it will definately work..
if it work'd properly on your local computer..
there should be some manual error..
 
Share this answer
 
v2
In your case, try using the IP address - that should work.

It is never a good idea to hard code the computer name / ip address in your datasource.
This should be configurable via a config file or something.
The reason is that you dont want to compile your code every time the database server changes.
 
Share this answer
 
v2
hi try this
private SqlConnection connection = new SqlConnection(@"Data Source=VG-VJGZTEST\\SQLEXPRESS;Initial Catalog=databasename;Integrated Security=SSPI;");
 
Share this answer
 
v2
look if you have enabled named pipes and TCP/IP in your sql server configuration manager or not

TCP/IP makes you able to connect using IP in your connection string

named pipes makes you able to connect using computer name in your connection string

I Hope I Helped
:)
 
Share this answer
 
Try take a look at Enable Remote Connection on SQL Server 2008 Express[^] and see if this help.
 
Share this answer
 
There are several possibilities for this starting from firewall problems, wrong IP port, disabled network protocols etc. Since you didn't mention the actual error you get, perhaps this list would help yo: http://msdn.microsoft.com/en-us/library/ms733742.aspx[^]
 
Share this answer
 
what is the operating system you are working on?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900