Click here to Skip to main content
15,352,484 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i am trying to open sql server2005 it gives me error
Cannot connect to DELL-PC\SQLEXPRESS.


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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (.Net SqlClient Data Provider)

plz help me|
Updated 5-Oct-12 23:10pm
Aarti Meswania 6-Oct-12 4:29am
show your connection string
NABIN SEN 6-Oct-12 5:05am
there is no problem in connection string.
When i am trying to open sql server 2005 database then gives a error.
Aarti Meswania 6-Oct-12 5:10am
are you using sql-authentication mode(userid-pwd)?
ridoy 6-Oct-12 5:25am
check your connection string.Your sql server can't get connection.Better if you share code here..then the problem comes to close

Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.

[edit]Removed pre tag added by paste operation :doh: - OriginalGriff[/edit]
sql connection string should be like below,

if sql server have Windows authentication Mode
"data source=ServerName; Initial Catalog=DatabaseName; Integrated security=true;"

if sql server have SQL authentication Mode
"data source=ServerName; Initial Catalog=DatabaseName; Uid=SQLServerLoginId;pwd=SQLServerPassword;" 

Happy Coding!
Check your connection string. May be credentials you are passing are not able to connect to you database server.

There may be state of sql server which you want to access is not in running state currently.
check few things
1.On desktop right click on my computer select manage(on the computer on which sql server is availabel)
2.In computer management click on services and application
3.In this click on sql server configuration management then click sql server services
4.Now check whether sql server state is running or not if not right click on it and select start.Do the same for sql server agent.
5.Also in sql native client,click client protocols check shared memory,tcp/ip/named pipes are enabled(search on net for this point)

i hope this will helps you.
Just Go to Sql Configuration Manager and Start the Services,

This will help you sure.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

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