web.config

<connectionStrings>
  
<add name="i05ConnectionString1"
  connectionString
="Data Source=localhost;Initial Catalog=i05;Integrated Security=True"
  providerName
="System.Data.SqlClient" />
  
<add name="i05ConnectionString2"
  connectionString
="Data Source=aidd2008;Initial Catalog=i05;User ID=i05;Password=i05630229"
  providerName
="System.Data.SqlClient" />
</connectionStrings>

 

 aspx


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="cno"
DataSourceID
="SqlDataSource1">
  
<Columns>
    
<asp:BoundField DataField="cno" HeaderText="cno" ReadOnly="True" SortExpression="cno" />
    
<asp:BoundField DataField="cname" HeaderText="cname" SortExpression="cname" />
    
<asp:BoundField DataField="ccredit" HeaderText="ccredit" SortExpression="ccredit" />
  
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString
="<%$ ConnectionStrings:i05ConnectionString2 %>"
SelectCommand
="SELECT * FROM [course]">
</
asp:SqlDataSource>

相关文章:

  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2021-12-15
  • 2021-11-25
  • 2021-12-05
  • 2021-11-29
  • 2021-09-23
  • 2021-10-03
相关资源
相似解决方案