sql server进行远程连接出现这样错误:...登录前的握手期间发生错误

来源:百度知道 编辑:UC知道 时间:2024/05/16 10:42:12
那个高手能帮我解决一下,谢谢了
客户端用进行SQL 配置吗?因为我用的C#.net编程,连接字符串怎么写(WINDOWS身份登录)??

string ss = "server=localhost;uid=“你的用户名”;password=“你的密码”;database=web";
SqlConnection conn = new SqlConnection(ss);
string mySelectQuery = "你的代码操做(Select,Delete等)";
SqlCommand myCommand = new SqlCommand(mySelectQuery, conn);
conn.Open();
SqlDataAdapter Adapter = new SqlDataAdapter();
Adapter.SelectCommand = myCommand;
DataSet myDs = new DataSet();
Adapter.Fill(myDs);

string sql=@"server=你的服务器名;database=你的数据库;integrated security=true";
因为你的服务器里面有“\” 你的运行环境无法识别转换字符
integrated security=true 是信任连接

这个问题我遇到过~~
修复下系统就OK了~~
.NET连接数据库字符串???
<appSettings>
<add key="ConnectString" --连接的字符串名字value="Server=服务器地址(本机为localhost);Database=数据库;User ID=用户名(默认sa);Password=密码(没有不写)"/>