WPF项目不带App.config
想要使用要在项目里新建app.config 但是切记名字写错就找不到了
1)新建App.config不要把名字写错是app.config多一个字母都找不到
2)增加引用 system.configuration
3)写app.config
<?xmlversion="1.0"encoding="utf-8"?><configuration><appSettings><!--连接字符串SQLServer--><addkey="SQLServer"value="server=数据库链接"/></appSettings></configuration>
4)代码写读取链接
protectedstaticstringconnectionString=ConfigurationManager.AppSettings["SQLServer"];
end~