⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 booksqldatasource.aspx

📁 一个网上书店的源码
💻 ASPX
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BookSqlDataSource.aspx.cs" Inherits="Admin_BookSqlDataSource" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id"
            DataSourceID="SqlDataSource1" Style="z-index: 100; left: 0px; position: absolute;
            top: 0px" AllowPaging="True" AllowSorting="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True"
                    SortExpression="Id" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="Author" HeaderText="Author" SortExpression="Author" />
                <asp:BoundField DataField="PublisherId" HeaderText="PublisherId" SortExpression="PublisherId" />
                <asp:BoundField DataField="PublishDate" HeaderText="PublishDate" SortExpression="PublishDate" />
                <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" />
                <asp:BoundField DataField="WordsCount" HeaderText="WordsCount" SortExpression="WordsCount" />
                <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />
                <asp:BoundField DataField="ContentDescription" HeaderText="ContentDescription" SortExpression="ContentDescription" />
                <asp:BoundField DataField="AurhorDescription" HeaderText="AurhorDescription" SortExpression="AurhorDescription" />
                <asp:BoundField DataField="EditorComment" HeaderText="EditorComment" SortExpression="EditorComment" />
                <asp:BoundField DataField="TOC" HeaderText="TOC" SortExpression="TOC" />
                <asp:BoundField DataField="CategoryId" HeaderText="CategoryId" SortExpression="CategoryId" />
                <asp:BoundField DataField="Clicks" HeaderText="Clicks" SortExpression="Clicks" />
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyBookShopConnectionString %>"
            DeleteCommand="DELETE FROM [Books] WHERE [Id] = @Id" InsertCommand="INSERT INTO [Books] ([Title], [Author], [PublisherId], [PublishDate], [ISBN], [WordsCount], [UnitPrice], [ContentDescription], [AurhorDescription], [EditorComment], [TOC], [CategoryId], [Clicks]) VALUES (@Title, @Author, @PublisherId, @PublishDate, @ISBN, @WordsCount, @UnitPrice, @ContentDescription, @AurhorDescription, @EditorComment, @TOC, @CategoryId, @Clicks)"
            SelectCommand="SELECT * FROM [Books]" UpdateCommand="UPDATE [Books] SET [Title] = @Title, [Author] = @Author, [PublisherId] = @PublisherId, [PublishDate] = @PublishDate, [ISBN] = @ISBN, [WordsCount] = @WordsCount, [UnitPrice] = @UnitPrice, [ContentDescription] = @ContentDescription, [AurhorDescription] = @AurhorDescription, [EditorComment] = @EditorComment, [TOC] = @TOC, [CategoryId] = @CategoryId, [Clicks] = @Clicks WHERE [Id] = @Id">
            <DeleteParameters>
                <asp:Parameter Name="Id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="PublisherId" Type="Int32" />
                <asp:Parameter Name="PublishDate" Type="DateTime" />
                <asp:Parameter Name="ISBN" Type="String" />
                <asp:Parameter Name="WordsCount" Type="Int32" />
                <asp:Parameter Name="UnitPrice" Type="Decimal" />
                <asp:Parameter Name="ContentDescription" Type="String" />
                <asp:Parameter Name="AurhorDescription" Type="String" />
                <asp:Parameter Name="EditorComment" Type="String" />
                <asp:Parameter Name="TOC" Type="String" />
                <asp:Parameter Name="CategoryId" Type="Int32" />
                <asp:Parameter Name="Clicks" Type="Int32" />
                <asp:Parameter Name="Id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="PublisherId" Type="Int32" />
                <asp:Parameter Name="PublishDate" Type="DateTime" />
                <asp:Parameter Name="ISBN" Type="String" />
                <asp:Parameter Name="WordsCount" Type="Int32" />
                <asp:Parameter Name="UnitPrice" Type="Decimal" />
                <asp:Parameter Name="ContentDescription" Type="String" />
                <asp:Parameter Name="AurhorDescription" Type="String" />
                <asp:Parameter Name="EditorComment" Type="String" />
                <asp:Parameter Name="TOC" Type="String" />
                <asp:Parameter Name="CategoryId" Type="Int32" />
                <asp:Parameter Name="Clicks" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -