WEB开发网
开发学院数据库MSSQL Server 使用SQL Server 2005的新函数构造分页存储过程 阅读

使用SQL Server 2005的新函数构造分页存储过程

 2009-10-25 00:00:00 来源:WEB开发网   
核心提示: c#相关代码的数据库访问使用的是微软的企业库 V4.1 Enterprise Library 4.1 下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyId=1643758B-2986-47F7-B529-3E41584B6CE

c#相关代码的数据库访问使用的是微软的企业库 V4.1

Enterprise Library 4.1 下载地址:

http://www.microsoft.com/downloads/details.aspx?FamilyId=1643758B-2986-47F7-B529-3E41584B6CE5&displaylang=en

示例代码,前台页面,前台为用户控件

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StudentDetailsTable.ascx.cs" Inherits="Kimbanx.UCS.ForeignStudentAdmin.UserControl.UserControl.StudentDetailsTable" %>
<link href="../css/core.css" rel="stylesheet" type="text/css" />
<table class="StudentPagingTablePanel">
    <tr>
        <td> 单位:<asp:Label ID="lblClassName" runat="server" Text="Label"></asp:Label></td>
        <td>级别:<asp:Label ID="lblClassLevel" runat="server" Text="Label"></asp:Label>级节点</td>
    </tr>
    <tr>
        <td>该单位共有<asp:Label ID="lblStudentType" runat="server" Text="Label"></asp:Label>学员
        <asp:Label ID="lblStudentCount" runat="server" Text="Label"></asp:Label>人</td>
        <td>每页显示<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True" 
                onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
            </asp:DropDownList>人 共<asp:Label ID="lblPageCount" runat="server" Text="Label"></asp:Label>页
             现为第<asp:Label ID="lblPageIndex" runat="server" Text="Label"></asp:Label>页 
            <asp:LinkButton ID="firstPage" runat="server" CommandArgument="first" 
                oncommand="LinkButton_Command">首页</asp:LinkButton> 
            
            <asp:LinkButton ID="nextPage" runat="server" CommandArgument="next" 
                oncommand="LinkButton_Command">下一页</asp:LinkButton> 
                <asp:LinkButton ID="prevPage" runat="server" CommandArgument="prev" 
                oncommand="LinkButton_Command">上一页</asp:LinkButton> 
            <asp:LinkButton ID="lastPage" runat="server" CommandArgument="last" 
                oncommand="LinkButton_Command">末页</asp:LinkButton>
        </td>
    </tr>
</table>
<br />
<asp:GridView ID="gvStudent" runat="server" AutoGenerateColumns="False" 
    EmptyDataText="没有符合条件的数据">
    <Columns>
        <asp:TemplateField HeaderText="照片">
            <ItemTemplate>
                <asp:Image ID="Image1" CssClass="studentImage" ImageUrl =<%# GetStudentImageUrl(Eval("zpadress")) %> runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="姓名(中英简)">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("xmjz") %>'></asp:Label>
                <br />
                <asp:Label ID="Label2" runat="server" Text='<%# Eval("xmjy") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="jx" HeaderText="军衔" />
        <asp:BoundField DataField="zw" HeaderText="职务" />
        <asp:BoundField DataField="gj" HeaderText="国家" />
        <asp:BoundField DataField="sjyqk" HeaderText="文化程度" />
        <asp:BoundField DataField="zj" HeaderText="宗教" />
        <asp:TemplateField HeaderText="出生/入伍">
            <ItemTemplate>
                <asp:Label ID="Label3" runat="server" Text='<%# SetBirthDate(Eval("csrq")) %>'></asp:Label>
                <br />
                <asp:Label ID="Label4" runat="server" Text='<%# SetEnrollDate(Eval("rwrq")) %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="xzz" HeaderText="房间/楼号" />
        <asp:TemplateField HeaderText="电话/小号">
            <ItemTemplate>
                <asp:Label ID="Label5" runat="server" Text='<%# Eval("dhd") %>'></asp:Label>
                <br />
                <asp:Label ID="Label6" runat="server" Text='<%# Eval("dhx") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="fcjp" HeaderText="返程机票" />
        <asp:BoundField DataField="xh" HeaderText="学号" />
    </Columns>
</asp:GridView>

上一页  1 2 3 4  下一页

Tags:使用 SQL Server

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接