I designing a application to connect to a remote database. my problem is how to achieve that and make the connection save and permanent. So that the user will not have to go through the process of re-connecting to the database server before they can use the application.
问问题
40 次
1 回答
0
我不知道您正在创建什么类型的应用程序。但是您可以在运行时向配置文件添加一个密钥,并在下次运行应用程序时调用它。
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["connectionString"].Value = "<connectionstring>";
config.Save(ConfigurationSaveMode.Modified);
于 2013-06-04T18:09:59.710 回答