Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I developed a Win Form Application by used C#2.0 and SQL Server 2005. I also created a Setup file of this application. I installed this application in the Client Machine. when I run this application on Client Machine it runs with an error given below :-
 
Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The Server was not found or was not accessible. Verify that the Instance name is correct and that SQL Server is configured to allow remote connections.(provider: Named Pipes Provider. error:40- Could not open a connection to Sql Server.)
 
I am very new to Window Application and unable to find out the reason. Please someone help me.
Posted 26-Jun-13 9:50am
Comments
Ron Beyer at 26-Jun-13 14:53pm
   
What is your connection string that you are using to connect to SQL server?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The error message is pretty explicit!
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The Server was not found or was not accessible. Verify that the Instance name is correct and that SQL Server is configured to allow remote connections.
 
Look at your code, and find the connection string you are using to connect to SQL Server. If you hard coded it - that's a problem, and you need to move it to a configuration file immediately.
When it's in a config file, you will need to edit it to reflect the path to the SQL server instance holding your database as seen by the new PC. Probably, it is set to your development machine incstance "LOCALHOST\SQLEXPRESS" or similar, with windows authorization set on. This needs to be changed to reflect the SQL instance that the client PC will be using, complete with the correct login details.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 BillWoodruff 173
3 PIEBALDconsult 160
4 CPallini 155
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 26 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100