调用方法:
1.设置
2.static System::String ^constr=System::Configuration ::ConfigurationManager ::AppSettings ["con"]->ToString ();取值
3.app.config内容如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key ="con" value ="server=192.168.52.12;uid=sa;pwd=sa123456;database=计算机文化基础;Connect Timeout=500;"/>
<add key ="serverfile" value ="http://192.168.52.12//SERVER//"/>
</appSettings>
</configuration>
引自:http://social.msdn.microsoft.com/Forums/zh-CN/vclanguage/thread/2f4e999f-37e6-436b-9a39-cf593e5308d3
First check if your configuration file appears renamed in output directory near your executable. Unlike C#, in C++ this file does not seem to be copied automatically.
If you did not yet set the copying operation, then right click on App.config file in Solution Explorer, go to Custom Build Step and type:
· In Command Line field:
copy "$(InputPath)" "$(TargetPath).config"
· In Outputs field:
$(TargetPath).config