日期:2014-05-16 浏览次数:20574 次
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="ConnStr" connectionString="Data Source=127.0.0.1;Initial Catalog=beta;Persist Security Info=True;User ID=sa;Password=123456"/>
</connectionStrings>
</configuration>
程序内获取数据库链接字符串方法:
1、先在"引用"中添加System.configuration的引用
2、读取string ConnStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString;