SQL2005 数据库连接

来源:百度知道 编辑:UC知道 时间:2024/05/22 19:31:19
用IIS 运行写好的代码.结果报错了!!
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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: 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)

Source Error:

Line 64: if (Connection.State.Equals(Conn

你的连接字符串有问题吧。可能是在连接字符串中指定的 server 不存在,或者不能访问端口(默认好像是1433)

==========================

SQL2005EXPRESS 好像是只能使用Trusted Connection,连接字符串要写成:
Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;

试试这个看行不行

不允许远程连接
SQL2005EXPRESS 没有数据实例.去装专业版才能本地开发

你说的只是客户端,用来连接服务器的数据库的!你需要装个数据库实例

把你连接数据库服务器的代码贴出来看看

你数据库连接的代码可能有问题,主要是里面的那个写你数据库配置的语句