你使用的是DataTable的方法吗?把代码放上来我帮你看一下.
刷新浏览器不是IsPostBack=false它获取一个值,该值指示该页是否正为响应客户端回发而加载,或者它是否正被首次加载和访问。[属性值
如果是为响应客户端回发而加载该页,则为 true;否则为 false。示例
[Visual Basic, C#, JScript] 下面的示例测试 IsPostBack 属性的值以在加载了 Page 时按条件为所有验证服务器控件调用 Page.Validate 方法。[Visual Basic]
Sub Page_Load
If Not IsPostBack
' Validate initially to force the asterisks
' to appear before the first roundtrip.
Validate()
End If
End Sub
[C#]
void Page_Load() {
if (!IsPostBack) {
// Validate initially to force asterisks
// to appear before the first roundtrip.
Validate();
}
}
[JScript]
function Page_Load() {
if (!IsPostBack) {
// Validate initially to force the asterisks
// to appear before the first roundtrip.
Validate();
}
}
2刷新浏览器ispostback=true
Create procedure updtable
(
@ID int,
@count int
)
as
update table set Count=@count where tableID=@ID //要定位到要更新得那一条记录
但取出的还是原来的値.
另外if (!Page.IsPostBack)
{
//Session.Add("exec_flag",true);
//exec_flag=false;
string updatestr="update forume_main set callcount=callcount+1 where productid="+productid +" and questionid="+ questionid;
OleDbCommand mycomm=new OleDbCommand(updatestr,userCommon.GetConnection(Server.MapPath("ebdpage.mdb")));
mycomm.ExecuteNonQuery();
mycomm.Dispose();
}
我将if 条件那里设为端点后刷新时,他确实为false呀。
select callcount from forume_main where productid="+productid +" and questionid="+ questionid;
productid,questionid,为主键。