开发者

Error while connecting to SQL server 2005

开发者 https://www.devze.com 2023-03-02 10:58 出处:网络
An error occured while establishing a connection to the server. When connecting to the SQL server 2005, the failure may be caused

An error occured while establishing a connection to the server. When connecting to the SQL server 2005, the failure may be caused by the fact that under the defa开发者_开发问答ult settings SQL server does not allow remote connections. (provider: Named pipes provider, error: 40 - Could not open a connection to SQL server)

I am using .NET framework provider for SQL Server and Visual Studio 2008.

Data Source=.\SQLEXPRESS;AttachDbFilename="";Integrated Security=True;User Instance=True

What am I missing here?


I know external references are bad, but it really does not get better than this:

http://www.connectionstrings.com/

as they say

 Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;


AttachDbFilename should be the path to the database filed (generally a .mdf) that you will be using.

Data Source=.\SQLEXPRESS;AttachDbFilename=c:\some.mdf;Integrated Security=True;User Instance=True


An error occured while establishing a connection to the server. When connecting to the SQL server 2005, the 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)

By default SQL Server Express disables remote connections via TCP/IP and Named Pipes, so you will need to enable these protocols in the SQL Server Configuration Manager (Start --> Programs --> Microsoft SQL Server 2008 --> Configuration Tools).

Error while connecting to SQL server 2005

I also agree with Hogan about ConnectionStrings.com great site!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号