




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
本文格式为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年牢牢坚守廉洁与廉政职业底线专题课件
- 0-3岁婴幼儿感觉统合训练知到智慧树章节测试课后答案2024年秋杭州师范大学
- 抑酸药课件教学课件
- 期末模拟卷 2024-2025学年人教版数学六年级上册(含答案)
- 脑干神经环路对意识的调控机制解析
- 动火作业应急预案样本(4篇)
- Unit 4 Plants around us(说课稿)-2024-2025学年人教PEP版(2024)英语三年级上册
- 2024集装箱储能系统测试大纲
- 新生儿重症监护室母乳使用专家共识(2024版)解读
评论
0/150
提交评论