SQL2005与VS2008连接失败的问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 17:10:44
DB是我创建的类代码如下:public class DB
{
public static SqlConnection CreateSqlConnection()
{
SqlConnection con = new SqlConnection("Server=.;database=XSCJ1;uid=sa;uid=;");
return con;
}
我是本地的啊,应该不是不需要远程连接的吧,我开了远程连接还是不行,求达人解决问题!

1. correct the connection string as ("Server=localhost;.....")

2. if 1) doesn't work, try below:

Go to SQL Server Configuration Manager | SQL Native Client Configuration | Client Protocols, make sure Named pipe or tcp is enabled; Click properties of Client Protocols, make Sure you see at least Named Pipe or tcp is in enabled protocols, plus, recommend put TCP on the top of the order.