错误消息如下:
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)这个错误在本机上调试的时候没有问题,因为本机安装了VS TEAM SUIT 版本,自带了SQLSERVER2005EXPRESS,不过我搞不明白的是我使用的是ms-sqlserver2000,关SQL Server 2005什么事啊?
数据库连接字符串如下: <add name="Default" providerName="System.Data.SqlClient" connectionString="Data Source=(local);Integrated Security=false; Initial Catalog=test;uid=sa;pwd=test"/>另外does not allow remote connections.也不大明白,因为服务器的管理员在使用该WEB程序访问数据库的时候也是同样的错误最后鄙视一下CSDN的发贴机制,刚才输错了分数,结果提交后敲的文字因为错误全部丢失了(幸亏我早知道,提交前把内容复制了),强烈鄙视

解决方案 »

  1.   

    http://yaxing.cnblogs.com/archive/2006/01/11/315502.html
      

  2.   

    =(local);这句改一下比如我的机器叫 aaa  那么sql2000 可能就是 aaa
    儿 sql 2005 就是aaa/SQLEXPRESS可能默认到了2005上面了。。不要用(local) 试试。。
      

  3.   

    哈哈,才看到。。楼主。。怎么不上msn 哦。
      

  4.   

    多谢楼上的
    不过问题并没有解决首先,服务器上只安装了Sqlserver2000
    其次,服务器上还有其他基于1.1开发的WEB程序,他们使用同样的字符串可以正常访问数据库
    服务器操作系统:windows2003
      

  5.   

    TOtrihero(不会写瞎写) 
    上MSN做什么?
      

  6.   

    问你问题哦,我的问题发出一中午了.每人解决:(
    http://community.csdn.net/Expert/topic/4708/4708899.xml?temp=.9085962
      

  7.   

    如果你默认用的vs2005中的wizard产生的connection对象,检查是不是用的web.config中的ConnectionStrings节点.看错误信息似乎是尝试链接sql2005的实例,2005默认关闭了remote connection,需要在surface area中打开
      

  8.   

    参见:http://blog.csdn.net/quou2002/archive/2005/12/21/558494.aspx深入研究:http://blog.csdn.net/quou2002/archive/2005/12/25/561477.aspx
    及http://community.csdn.net//Expert/TopicView2.asp?id=4537158&datebasetype=now 中我的回复==== 
    ~~~~ 我的Blog:http://blog.csdn.net/quou2002 
      

  9.   

    搞定,结贴咯
      <connectionStrings>
        <add name="Default" connectionString="Data Source=(local);Integrated Security=false;Initial Catalog=HubuVod;uid=sa;pwd=test" providerName="System.Data.SqlClient" />
        <remove name="LocalSqlServer"/>
        <add name="LocalSqlServer" connectionString="Data Source=(local);Integrated Security=false;Initial Catalog=HubuVod;uid=sa;pwd=test" providerName="System.Data.SqlClient"/>
      </connectionStrings>这个是最终使用的连接字符串,我只做了这个更改,没有进行其他配置就OK了多谢大家,THANKS