




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
本文格式为Word版下载后可任意编辑和复制第第页代码个人工作总结
分页:
usingSystem;
usingSystem.Collections;
usingSystem.Configuration;
usingSystem.Data;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.HtmlControls;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Xml.Linq;
usingSystem.Configuration;
usingSystem.Data.SqlClient;
publicpartialclasstemplates_scanmessageboard:System.Web.UI.Page
{
publicstaticintcurrentpages=1;
publicstaticinttatolpages=1;
publicstaticintsize=5;
publicstaticintm=0;
protectedvoidPage_Load(objectsender,EventArgse)
{
stringcon=ConfigurationSettings.AppSettings[sqlconn];
SqlConnectionconn=newSqlConnection(con);
conn.Open();
SqlCommandcmd=newSqlCommand();
cmd.Connection=conn;
cmd.CommandType=CommandType.Text;
cmd.CommandText=selectcount(*)frommessage;
inti=Convert.ToInt32(cmd.ExecuteScalar());
tatolpages=i/size;
m=i%size;
if(tatolpages==0)
{
cmd.CommandText=select*frommessage;
SqlDataReadersdr=cmd.ExecuteReader();
while(sdr.Read())
{
Label1.Text+=(divclass=contentbrdiv
style=width:300px;float:left;+sdr[Ucontent]+/divdivstyle=float:rightahref=detailmessage.aspx?id=+sdr[id]+查看详情/a——ahref=pinlun.aspx?id=+sdr[id]+批阅留言/a——ahref=deletemessage.aspx?id=+sdr[id]+删除留言
/a/div/divhrsize=3width=100%/);
}
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages+1)+页;conn.Close();
conn.Dispose();
}
else
{
cmd.CommandText=selecttop+size+*frommessagewhere(idnotin(selecttop+(currentpages-1)*size+idfrommessageorderbyiddesc))orderbyiddesc;
SqlDataReadersdr=cmd.ExecuteReader();
while(sdr.Read())
{
Label1.Text+=(divclass=contentbrdiv
style=width:300px;float:left;+sdr[Ucontent]+/divdivstyle=float:rightahref=detailmessage.aspx?id=+sdr[id]+查看详情/a——ahref=pinlun.aspx?id=+sdr[id]+批阅留言/a——ahref=deletemessage.aspx?id=+sdr[id]+删除留言/a/div/divhrsize=3width=100%/);
}
if(m==0)
{
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages)+页;}
else
{
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages+1)+页;
}
conn.Close();
conn.Dispose();
}
}
protectedvoidButton1_Click(objectsender,EventArgse)
{
currentpages=1;
Label1.Text=;
Label2.Text=;
stringcon=ConfigurationSettings.AppSettings[sqlconn];
SqlConnectionconn=newSqlConnection(con);
conn.Open();
SqlCommandcmd=newSqlCommand();
cmd.Connection=conn;
cmd.CommandType=CommandType.Text;
cmd.CommandText=selecttop+size+*frommessagewhere(idnotin(selecttop+(currentpages-1)*size+idfrommessageorderbyiddesc))orderbyiddesc;SqlDataReadersdr=cmd.ExecuteReader();
while(sdr.Read())
{
Label1.Text+=(divclass=contentbrdivstyle=width:300px;float:left;+sdr[Ucontent]+/divdivstyle=float:rightahref=detailmessage.aspx?id=+sdr[id]+查看详情/a——ahref=pinlun.aspx?id=+sdr[id]+批阅留言/a——a
href=deletemessage.aspx?id=+sdr[id]+删除留言/a/div/divhrsize=3
width=100%/);
}
if(m==0)
{
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages)+页;}
else
{
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages+1)+页;}
conn.Close();
conn.Dispose();
}
protectedvoidButton3_Click(objectsender,EventArgse)
{
if(m==0)
{
if(currentpages(tatolpages))
{
currentpages=currentpages+1;
Label1.Text=;
Label2.Text=;
stringcon=ConfigurationSettings.AppSettings[sqlconn];
SqlConnectionconn=newSqlConnection(con);
conn.Open();
SqlCommandcmd=newSqlCommand();
cmd.Connection=conn;
cmd.CommandType=CommandType.Text;
cmd.CommandText=selecttop+size+*frommessagewhere(idnotin(select
top+(currentpages-1)*size+idfrommessageorderbyiddesc))orderbyiddesc;SqlDataReadersdr=cmd.ExecuteReader();
while(sdr.Read())
{
Label1.Text+=(divclass=contentbrdiv
style=width:300px;float:left;+sdr[Ucontent]+/divdivstyle=float:rightahref=detailmessage.aspx?id=+sdr[id]+查看详情/a——ahref=pinlun.aspx?id=+sdr[id]+批阅留言/a——ahref=deletemessage.aspx?id=+sdr[id]+删除留言/a/div/divhrsize=3width=100%/);
}
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages)+页;conn.Close();
conn.Dispose();
}
else
{
this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(),key,alert(已是最终一页!);,true);
Response.Redirect(scanmessageboard.aspx);
}
}
else
{
if(currentpages=(tatolpages))
{
currentpages=currentpages+1;
Label1.Text=;
Label2.Text=;
stringcon=ConfigurationSettings.AppSettings[sqlconn];
SqlConnectionconn=newSqlConnection(con);
conn.Open();
SqlCommandcmd=newSqlCommand();
cmd.Connection=conn;
cmd.CommandType=CommandType.Text;
cmd.CommandText=selecttop+size+*frommessagewhere(idnotin(selecttop+(currentpages-1)*size+idfrommessageorderbyiddesc))orderbyiddesc;SqlDataReadersdr=cmd.ExecuteReader();
while(sdr.Read())
{
Label1.Text+=(divclass=contentbrdiv
style=width:300px;float:left;+sdr[Ucontent]+/divdivstyle=float:rightahref=detailmessage.aspx?id=+sdr[id]+查看详情/a——ahref=pinlun.aspx?id=+
sdr[id]+批阅留言/a——ahref=deletemessage.aspx?id=+sdr[id]+删除留言/a/div/divhrsize=3width=100%/);
}
Label2.Text+=当前页数为:+currentpages+--共+(tatolpages+1)+页;
conn.Close();
conn.Dispose();
}
else
{
this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(),key,alert(已是最终一页!);,true);
Response.Redirect(scanmessageboard.aspx);
}
}
}
protectedvoidButton2_Click(objectsender,EventArgse)
{
if(currentpages1)
{
currentpages=currentpages-1;
Label1.Text=;
Label2.Text=;
stringcon=ConfigurationSettings.AppSettings[sqlconn];
SqlConnectionconn=newSqlCo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025镀锌钢管骨架采购合同
- 2025二级建造师建设工程施工管理考点:合同管理索赔程序
- 2025年武汉单身公寓租赁合同模板
- 2025设备安装合作协议合同范本
- 2025信息安全咨询技术合同
- 2025水果收购合同书样本
- 2025【景观设计合同】景观工程设计包括内容
- 《胃镜检查技术》课件
- 2025标准简化版合同范本
- 2025标准版:员工签订长期合同协议范本
- 湖北浅圆仓滑模施工方案
- 第二章第二节氯气及其化合物-氯气制备及性质微型化实验改进设计 教学设计 2024-2025学年高一上学期化学人教版(2019)必修第一册
- 电梯的应急预案培训
- 高中语文部编版教材单元写作任务(必修上下册+选择性必修上中下册)
- 2025年国际教育资源共享合同范本
- GB/T 45166-2024无损检测红外热成像检测总则
- 脱硝催化剂环境影响评估-洞察分析
- 2025年春新外研版(三起)英语三年级下册课件 Unit4第1课时Startup
- 2025年异位妊娠诊断与治疗策略研究综述
- 2025年福建省龙岩市武平县乡村振兴战略储备人才引进18人历年高频重点提升(共500题)附带答案详解
- 人教版(2025新版)七年级下册数学第七章 相交线与平行线 单元测试卷(含答案)
评论
0/150
提交评论