尝试从 c# 代码连接到 ms sql,但收到此错误。如果我像这样进行简单的连接:
String connect = "server=MY-PC\\SQLEXPRESS; database=mydb; Integrated Security=SSPI;";
con.ConnectionString = connect;
但是当我从 app.config 尝试 connecto 时,我收到了这个错误:
String connect = ConfigurationManager.AppSettings["connectionString"];
con.ConnectionString = connect ;
这是xml代码:
<configuration>
<appSettings>
<add key="connectionString" value="server=MY-PC\\SQLEXPRESS; database=mydb; Integrated Security=SSPI;"/>
</appSettings>
</configuration>
一些想法?