Click here to Skip to main content
15,885,944 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
Hi everybody,

Firstly, excuse me if I opened my subject in wrong place.

And let me explain my story in a short way.

I developed a Windows application with VS 2008 C# and SQL Server 2005. I installed my application on test environment.There was no error when
installing.But,when I try to run my program, it gave me the error below:

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

My test environment specifications are:

- Windows XP SP2
- NET Framework 3.5
- SQL server 2005 express

My deployment package has Windows Intaller 3.1, NET framework 3.5, SQL server 2005 express sp2, and my application.

In order to test my SQL server 2005 express on test machine, I installed SSMS Express. I can reach my sql instance as its name is SQL_Express.And I can do my database actions by using SSMS Express.

But,when I tried to run my application, I take this error above. :(

Can someone help me please?

Thanks of all.

Kerem
Posted
Updated 11-Feb-11 10:24am
v2

Perhaps your ConectionString is wrong , use ".\SQLEXPRESS" or "localhost\SQLEXPRESS" in your connection string.(in app.confog file)
 
Share this answer
 
If you are using ODBC settings, check that these have been configured properly.
 
Share this answer
 
Few things to check:
- is the SQL Server listening on remote clients (remote connections allowed). You can use the configuration utility on the server side to check this
- Did you install named instance. If yes, do you include the instance name in your connection string
- Firewall between client and server? Is it configured correctly to allow traffic.
 
Share this answer
 
hi,

arvane's answer is good for me.it is OK. I changed instance name from my c#code.then I can get it.

thanks.
 
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