i have a page called books.aspx which have the code as below:
i have another page called bookcollection.aspx and code as below:Code:<%@ Page Language="VB" MasterPageFile="~/Default.master" AutoEventWireup="false" CodeFile="Books.aspx.vb" Inherits="BookCollection" title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server"> <div class="page" id="home"> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="No" DataSourceID="AccessDataSource1" EmptyDataText="There are no data records to display."> <Columns> <asp:CommandField ShowEditButton="True" ShowSelectButton="True" /> <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /> <asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" /> <asp:HyperLinkField Text="View" DataNavigateUrlFields="No" DataNavigateUrlFormatString="BookCollection.aspx?ID={0}" /> </Columns> </asp:GridView> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="App_Data\bookcollection.mdb" DeleteCommand="DELETE FROM `Books` WHERE `No` = ?" InsertCommand="INSERT INTO `Books` (`No`, `Title`, `Author`) VALUES (?, ?, ?)" SelectCommand="SELECT [No], Title, Author FROM Books" UpdateCommand="UPDATE `Books` SET `Title` = ?, `Author` = ? WHERE `No` = ?"> <InsertParameters> <asp:Parameter Name="No" Type="Int16" /> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="Author" Type="String" /> </InsertParameters> <DeleteParameters> <asp:Parameter Name="No" Type="Int16" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="Author" Type="String" /> <asp:Parameter Name="No" Type="Int16" /> </UpdateParameters> </asp:AccessDataSource> </asp:Content>
i want show the details in "bookcollection.aspx" page when i click the "view" in "books.aspx". But , with code above. i can't get the result. what wrong for my code.Code:<%@ Page Language="VB" MasterPageFile="~/Default.master" AutoEventWireup="false" CodeFile="BookCollection.aspx.vb" Inherits="Books" title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server"> <div class="page" id="home"> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="No" AllowPaging="true" DataSourceID="AccessDataSource2" Height="50px" Width="125px"> <Fields> <asp:BoundField DataField="No" HeaderText="No" ReadOnly="True" SortExpression="No" /> <asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" /> <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" /> <asp:BoundField DataField="Publisher" HeaderText="Publisher" SortExpression="Publisher" /> <asp:BoundField DataField="YearPublished" HeaderText="YearPublished" SortExpression="YearPublished" /> <asp:BoundField DataField="Edition" HeaderText="Edition" SortExpression="Edition" /> <asp:BoundField DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" /> </Fields> </asp:DetailsView> <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/bookcollection.mdb" SelectCommand="SELECT [No], Author, ISBN, Publisher, YearPublished, Edition, Remarks, Photograph FROM Books WHERE ([No] = ?)" OldValuesParameterFormatString="original_{0}"> <SelectParameters> <asp:QueryStringParameter DefaultValue="1" Name="No" QueryStringField="No" Type="Int16" /> </SelectParameters> </asp:AccessDataSource> <br /> </div> </asp:Content>




Reply With Quote