Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Error 40/cmd.Connection.Open()

Author  Topic 

Draconfly
Starting Member

1 Post

Posted - 2010-08-20 : 20:39:25
Hi Folks!

I have an inherited application based off an Access db that is now a SQL 2005. And now it is throwing this error: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)
With the debug set to "true" in the Web.config it states:

Source Error:

Line 31: cmd.CommandType = CommandType.Text;
Line 32: cmd.Connection = conn;
Line 33: cmd.Connection.Open();
Line 34: dr = cmd.ExecuteReader();
Line 35: if (dr.Read())

Using TCP and not named pipes, every thing is up and running, moves throw firewall, positive responses when pinged. Connection string in web.config in good shape.

I am not sure why the line "cmd.Connection.Open();" from the aspx.cs file is causing an issue.

Can anyone suggest anything. I really need to get this working again and this is not my IT areana.

THANK YOU IN ADVANCE!!!
Draconfly


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-08-20 : 23:58:31
Try using ServerName,PortNumber in the connection string.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -