首先创建一张表(要求ID自动编号):

create table redheadedfile
(
    id          
int identity(1,1),
    filenames   
nvarchar(20),
    senduser    
nvarchar(20),
    
primary key(id)
)

然后我们写入50万条记录:

declare @i int
set @i=1
while @i<=500000
begin
    
insert into redheadedfile(filenames,senduser) values('我的分页算法','陆俊铭')
    
set @i=@i+1
end
GO

 用Microsoft Visual Studio .net 2003创建一张WebForm网页(本人起名webform8.ASPx)
前台代码片段如下(webform8.aspx):

<%@ Page language="C#" Codebehind="WebForm8.aspx.cs" AutoEventWireup="false" Inherits="WebApplication6.WebForm8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
 
<HEAD>
  
<title>WebForm8</title>
  
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
  
<meta content="C#" name="CODE_LANGUAGE">
  
<meta content="JavaScript" name="vs_defaultClientScript">
  
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
 
</HEAD>
 
<body MS_POSITIONING="GridLayout">
  
<form id="Form1" method="post" runat="server">
   
<asp:datalist id="datalist1" AlternatingItemStyle-BackColor="#f3f3f3" Width="100%" CellSpacing="0"
    CellPadding
="0" Runat="server">
    
<ItemTemplate>
     
<table width="100%" border="0" cellspacing="0" cellpadding="0">
      
<tr>
       
<td width="30%" align="center"><%#DataBinder.Eval(Container.DataItem,"filenames")%></td>
       
<td width="30%" align="center"><%#DataBinder.Eval(Container.DataItem,"senduser")%></td>
       
<td width="30%" align="center"><%#DataBinder.Eval(Container.DataItem,"id")%></td>
      
</tr>
     
</table>
    
</ItemTemplate>
   
</asp:datalist>
   
<div align="center"><asp:label id="LPageCount" Runat="server" ForeColor="#ff0000"></asp:label>页/共
         <asp:label id="LRecordCount" Runat="server" ForeColor="#ff0000"></asp:label>记录
        
<asp:linkbutton id="Fistpage" Runat="server" CommandName="0">首页</asp:linkbutton>&nbsp;&nbsp;&nbsp;&nbsp;
         <asp:linkbutton id="Prevpage" Runat="server" CommandName="prev">上一页</asp:linkbutton>&nbsp;&nbsp;&nbsp;&nbsp;
         <asp:linkbutton id="Nextpage" Runat="server" CommandName="next">下一页</asp:linkbutton>&nbsp;&nbsp;&nbsp;&nbsp;
         <asp:linkbutton id="Lastpage" Runat="server" CommandName="last">尾页</asp:linkbutton>&nbsp;&nbsp;&nbsp;&nbsp;当前第
         <asp:label id="LCurrentPage" Runat="server" ForeColor="#ff0000"></asp:label>&nbsp;&nbsp;&nbsp;&nbsp;跳页
         <asp:TextBox ID="gotoPage" Runat="server" Width="30px" MaxLength="5" AutoPostBack="True"></asp:TextBox>
   </div>
  
</form>
 
</body>
</HTML>

相关文章:

  • 2022-12-23
  • 2021-09-20
  • 2021-09-11
  • 2021-05-26
  • 2022-02-14
  • 2022-01-16
  • 2021-07-25
猜你喜欢
  • 2021-11-02
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案