2.或是在右边项目名中添加外键引用 System.Configuraton;
xml文件配置如下:
</configurations>
</connectionStrings>
</configuration>
从配置文件中读取数据库连接字符串
private readonly string connString=ConfigurationManager.ConnectionStrings["MySchoolConnectionString "].ToString();
private readonly string dboOwner=ConfigurationManager.ConnectionStrings[" DataBaseOwner "].ToString();