自学.net(3)把数据库连接信息写入App.config配置文件

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

 <connectionStrings>

    <add name="dbConnStr" connectionString="Data Source=.;Initial Catalog=Test;User ID=sa;Password=newmap"/>

  </connectionStrings>

</configuration>

在vs中新建项“应用程序配置文件”,然后按上面代码配置,最后别忘了在解决方案管理器添加引用System.Configuration

你可能感兴趣的:(config)