★如果需要考虑如时间的过滤、其他条件的加入...... 如果需要考虑如时间的过滤、其他条件的加入,可以在SQL语句进行编辑,普通的网站,下面的数据浏览分页 就可以了。 aspx代码: <%@ Page language="c#" Codebehind="StockOrderFormBrower.aspx.cs" AutoEventWireup="false" Inherits="GSP.StockOrderFormBrower" %> 用C#和SQL结合进行数据浏览分页 aspx.cs代码: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; namespace ASWBLM { /// /// /// public class UnionInfo : System.Web.UI.Page { protected System.Web.UI.HtmlControls.HtmlInputButton first; protected System.Web.UI.HtmlControls.HtmlInputButton prior; protected System.Web.UI.HtmlControls.HtmlInputButton last; protected System.Web.UI.HtmlControls.HtmlInputButton next; protected static int CurrentPage = 1;//初始化开始页面 protected static int RowCount = 0 ;//本页有多少条 private static bool IsPrior = false;//有“前一页” private static bool IsNext = false;//有“下一页” private static bool IsLast = false;//有“最后一页” protected static int not_shown_records=0;//计算未显示记录数 private static string startID = "";//设置上一页开始ID private static string endID = "";//设置下一页结束ID private static int page_count = 10;//初始化页面记录数 private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!IsPostBack) { this.CountRecord().ToString();// 记录总数 this.Page_Count().ToString();//分页总数 Init_Brower();//初始化浏览 } } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.first.ServerClick += new System.EventHandler(this.first_ServerClick); this.prior.ServerClick += new System.EventHandler(this.prior_ServerClick); this.next.ServerClick += new System.EventHandler(this.next_ServerClick); this.last.ServerClick += new System.EventHandler(this.last_ServerClick); this.Load += new System.EventHandler(this.Page_Load); } #endregion /// /// 显示数据 /// protected void ShowData() { DataSet ds = new DataSet();//数据集 ASWBLM.Include.UnionInfo_Provider _uip = new ASWBLM.Include.UnionInfo_Provider(); string vSQL = ""; vSQL = GetSQLCommond(vSQL,startID,endID); ds = _uip.ShowAllUnionInfo(vSQL);//取得全部数据的数据集 try { Response.Write(" "); | |
"); Response.Write(""); Response.Write(dr["Title"].ToString()); Response.Write(""); Response.Write(" | ");"); Response.Write(""); Response.Write("( "+dr["SummaryDateTime"].ToString()+" )"); Response.Write(" ( 已阅读"+dr["ReadTimes"].ToString()+"次 )"); Response.Write(""); Response.Write(" | ");
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-29 17:38 , Processed in 0.160070 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.