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.
| Author |
Topic |
|
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2008-09-12 : 03:29:00
|
| Hi ,What could be the reason for this error? System.Data.SqlClient.SqlException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)It was not throwing the error as before. while opening the connection cn.Open(); // Fill the dataset da.Fill(ds, "Departments"); // Clean up cn.Close(); |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-09-12 : 03:36:30
|
Have you configured the SQL Server to allow remote connections ? Go to Surface Area Configuration and do it there. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2008-09-12 : 04:59:01
|
| Hi,I tried to all options in surface area configuration tool.still i am getting the same error.what can i check next? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-09-12 : 05:12:39
|
Surface Area Configuration - Services and connections - Database Engine - Remote Connections - Local and Remote Connections KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-12 : 05:18:16
|
| This is not an MS SQL error. Its a .net errorCheck your connection strings to properly set your connection string see www.connectionstrings.com A few pointers also: Dont use named pipes, use TCP/IPDid you declare your sql namespace ?code: using System.Data.SqlClient |
 |
|
|
|
|
|