日期:2014-05-19  浏览次数:20727 次

VS2005下数据库连接的问题
我现在安装了VS2005,但数据库用的仍然是SQL   Server2000,在程序中连接到数据库时发生如下错误:
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),

是不是在VS2005中不能用SQL   Server2000,只能用SQL   Server2005?   我还没装SQL   Server2005.如果可以用SQL   Server2000,我应该做哪些设置?
谢谢各位了!

------解决方案--------------------
VS2005连接SQL Server2000没任何问题
要不微软也太面了
------解决方案--------------------
using System.Data.SqlClient;

private SqlConnection cn = new SqlConnection
( "Server=.;database=NorthWind;uid=sa;pwd=xx ");
------解决方案--------------------
http://www.cnblogs.com/bullion/archive/2007/03/03/662905.html
------解决方案--------------------
不会不能连接的,我现在用的还是2000数据库。检验你的连接设置。要么是不是SQL Server2000服务未正常启动什么的?