Click here to Skip to main content
11,920,394 members (51,792 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# SQL Application Server
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. Frown | :(

Can someone help me please?

Thanks of all.

Posted 11-Feb-11 4:11am
Edited 11-Feb-11 11:24am
Henry Minute224.8K
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Perhaps your ConectionString is wrong , use ".\SQLEXPRESS" or "localhost\SQLEXPRESS" in your connection string.(in app.confog file)
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you are using ODBC settings, check that these have been configured properly.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4


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


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

  Print Answers RSS
0 OriginalGriff 415
1 phil.o 170
3 F-ES Sitecore 130
4 RyanDev 120
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,805
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 11 Feb 2011
Copyright © CodeProject, 1999-2015
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