我用的是SQL Server2000,为什么会出现这个错误:
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。(provide:命名管道提供程序,error: 40-无法打开到SQL Server的连接)SqlConnection(Data Source =.; User ID=sa; Password=fjin; Initial Catalog = cztj; Integrated Security = true)大家帮帮忙吧。
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。(provide:命名管道提供程序,error: 40-无法打开到SQL Server的连接)SqlConnection(Data Source =.; User ID=sa; Password=fjin; Initial Catalog = cztj; Integrated Security = true)大家帮帮忙吧。
<add name="e2state_RoleConnectionString" connectionString="Data Source=(local);Initial Catalog=user_role;Password=;User ID=sa;Max Pool Size=32767; Min Pool Size=0" providerName="System.Data.SqlClient"/>2005下连接字符串,你改成
Data Source=localhost\SQLEXPRESS
public static SqlConnection getSqlConnection()
{ return new SqlConnection("server=SDSERVER\\SD;database=e8;uid=sa;pwd=sd");
}
Web.config
:<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=SDSERVER\SD;Initial Catalog=DD2;User ID=sa;Password=sd8" providerName="System.Data.SqlClient"/>
</connectionStrings>
server 写"." 不行,换ip本地 127.0.0.1 或者 sql服务器名称试试。
在看看sql服务有没有开启,开启了,手动刷新。sa密码是不是对的。