在程序中连接MSSQL EXPRESS失败的解决办法
日期:2011-10-22 阅读:19 分类:综合信息
在win7上安装了 MSSQL EXPRESS之后,用asp连接不上,报了一个错误,说是无法连接上sql server,然后用 netstat -ano看了下,发现1433端口没有被监听。
连接字符串为:
provider=sqloledb;data source=localhost,1433;User ID=sa;pwd=sa;Initial Catalog=***
于是在网上找了一些方法,参考了设置了下 sqlserver 的 server端和client端,发现还是无法监听1433端口。
此时用SQL Server Management连接报以下错误:
TITLE: Connect to Server
------------------------------
Cannot connect to localhost.
------------------------------
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
最后的解决办法:
把连接字符串改为 provider=sqloledb;data source=XINJU\SQLEXPRESS;User ID=sa;pwd=sa;Initial Catalog=***,问题解决。
本页链接: http://www.scriptlover.com/static/1020-sqlserver2005-连接失败
标签: sqlserver2005 连接失败
相关文章
- Asp连接不上sqlserver2005错误解决 2011-08-03