<%@ Page Language="VB" AutoEventWireup="false" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Books]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Books] WHERE (([BookID] <= @BookID) AND ([YearPublished] = @YearPublished)) ORDER BY [Price] DESC, [Title]">
<SelectParameters>
<asp:Parameter DefaultValue="3" Name="BookID" Type="Int32" />
<asp:Parameter DefaultValue="2005" Name="YearPublished" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BookID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="BookID" HeaderText="BookID" InsertVisible="False" ReadOnly="True"
SortExpression="BookID" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" />
<asp:BoundField DataField="YearPublished" HeaderText="YearPublished" SortExpression="YearPublished" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="LastReadOn" HeaderText="LastReadOn" SortExpression="LastReadOn" />
<asp:BoundField DataField="PageCount" HeaderText="PageCount" SortExpression="PageCount" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
File: Web.Config
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyFirstDatabase.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
|