在app.config里面写上下面的代码:connectionString="Data Source=PC-200908251645;Initial Catalog=School;Integrated Security=True"providerName="System.Data.SqlClient" />然后访问时写上:SqlConnection con =new SqlConnection("server=PC-200908251645;database=school;Integrated Security=True")
c# 连接字符串代码实例提供