引用
System.configuration库
读取代码
Dim connectionString As System.Configuration.ConnectionStringSettings _
= System.Configuration.ConfigurationManager.ConnectionStrings("lily")
MsgBox(connectionString.ConnectionString)
App.config配置文件结构
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="lily" connectionString="server=.;user=sa;pwd=;database=test"/>
</connectionStrings>
<system.diagnostics>