<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="sqlserver" connectionString="Data Source=WT01395\sqlexpress;Initial Catalog=mydb;Integrated Security=True"/> </connectionStrings> <appSettings> <add key=""/> </appSettings> </configuration>
app.config
引入Configuration的 References库读取string conStr = ConfigurationManager.ConnectionStrings["sqlserver"].ToString();
用于保存数据写入 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings.Remove("lastLoginUser"); config.AppSettings.Settings.Add("lastLoginUser", userName); config.Save();只会把值写入到OesShareUI.exe.Config 不会写在 源文件上
时间: 2024-10-07 18:49:44