标签:app alt form .com const class cli box level
1.app.config配置文件修改
<?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="connectionString" connectionString="data source=127.0.0.1;persist security info=True;user id=test;password=test123" providerName="System.Data.SqlClient" /> </connectionStrings> <appSettings> <add key="verson" value="1.0.0" /> <add key="DownLoad" value="2" /> </appSettings> </configuration>
2.连接字符串的引用
using System.Configuration;
string conStr = ConfigurationManager.ConnectionStrings["connectionString"].ToString(); MessageBox.Show(conStr);
3.appSettings 配置的调用
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string strval = cfa.AppSettings.Settings["DownLoad"].Value; MessageBox.Show(strval);
标签:app alt form .com const class cli box level
原文地址:https://www.cnblogs.com/aj407blogs/p/9737997.html