关于变量加1问题????
我定义了三个变量
public int PageNum=20;
public int PageCount=1;
public int PageTotal;
.............
string cmdtext = " ";
PageTotal = PageNum * PageCount;
cmdtext = @ "SELECT TOP " + PageNum + " ID, SUBJECT, CONVERT(varchar(10), FBTIME, 120) AS FBTIME, FILENAME,AUTHOR FROM NEWS_INFO WHERE (ID NOT IN(SELECT TOP " + PageTotal + " id FROM NEWS_INFO WHERE TYPEID = 1 AND STATUS = '0 ' ORDER BY FBTIME DESC)) AND (TYPEID = 1) AND (STATUS = '0 ') ORDER BY FBTIME DESC ";
----------------------------
想点击LinkButton时候,每次让PageCount加1,可是每次总刷新一次,PageCount总是不会加1???
------解决方案--------------------public int PageCount=1;
======================
每次回传就重新开始了..
简单一点 public static int PageCount=1;
------解决方案--------------------可将其定义成Application
------解决方案--------------------1。
原因如 高歌 所述
2。
想点击LinkButton时候,每次让PageCount加1,可是每次总刷新一次,PageCount总是不会加1???
》》》》》
a.将 PageCount 存到 ViewState 中
ViewState[ "__PageCount "] = PageCount;
b.用的时候取出来
PageCount = ViewState[ "__PageCount "] == null ? 1 : (int)ViewState[ "__PageCount "];
------解决方案--------------------可将其定义成Application
===========
这个更扯!!!!!!