获取App.config中的连接字符串
App.config中:
<appSettings> <add key="connectionstring" value="Data Source=127.0.0.1;Initial Catalog=DatabaseName;Persist Security Info=True;
User ID=sa;Password=sa"/> </appSettings>
调用的地方:
private string connStr = ConfigurationManager.AppSettings["connectionstring"];
程序集引用:
using System.Configuration;