GridView测试实例

Web.config中配置数据库连接字符串:
<appSettings>
    
<add key="ContactsDatabase" value="server=hi4-sv09; User ID=MyBeer_test;Password=mybeertest;database=MyBeer20G;Connection Reset=FALSE;Max Pool Size=1000; Min Pool Size=5" />
    
</appSettings>

前台页面:
<asp:GridView ID="GridView1" DataSourceID="SqlDataSource1" runat="server" />
            
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
              SelectCommand
="SELECT * FROM [qkpi_item]"
              ConnectionString
="<%$ appSettings:ContactsDatabase %>" />    
原文地址:https://www.cnblogs.com/songsh96/p/660500.html