我看到了很多答案,但我仍然不能为我做好准备。
sudo su -
我无法使用Windows身份验证在Windows上创建连接字符串。我也试过了:
<connectionStrings>
<add
name="conString"
connectionString="Data Source=(local);Initial Catalog=wb_lab_1;Integrated Security=True"
providerName="System.Data.MysqlClient"
/>
</connectionStrings>
Server=127.0.0.1;Database=wb_lab_1;IntegratedSecurity=yes;Uid=auth_windows;
但我仍然遇到Server=(local);Database=wb_lab_1;IntegratedSecurity=yes;Uid=auth_windows;
错误。我哪里错了?
UPD:这是我在C#中尝试连接的方式:
Keyword not supported
答案 0 :(得分:0)
更改
providerName="System.Data.MysqlClient"
到
providerName="System.Data.SqlClient"
答案 1 :(得分:0)
变化:
String connString = System.Configuration.ConfigurationManager.ConnectionStrings["conString"].ToString();
conn = new MySql.Data.MySqlClient.MySqlConnection(connString); // here I got an Exception
要:
String connString = System.Configuration.ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
conn = new System.Data.SqlClient.SqlConnection(connString); // should work