Connection String
The following connection string has been set in the ConnectionStrings section of the Web.Config file.
- <connectionStrings>
- <add name="constr" connectionString="Data Source=.\SQL2008;Initial Catalog=myschool;Integrated Security=true" />
- </connectionStrings>
Html Markup
- <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false">
- <Columns>
- <asp:BoundField DataField="CustomerId" HeaderText="Customer Id" />
- <asp:BoundField DataField="ContactName" HeaderText="Contact Name" />
- <asp:BoundField DataField="Country" HeaderText="Country" /> </Columns>
- </asp:GridView>
- <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT TOP 10 * FROM Customers"></asp:SqlDataSource>