为什么ExecuteNonQuery执行成功了返回1,但Access还是没有被更新?
按钮程序如下:
protected void Button1_Click(object sender, EventArgs e)
{
strSQL = "update config set grade_name=@GradeName,grade_year=@GradeYear,xuenian=@xuenian,xueqi=@xueqi,Dormitory=@Dormitory,xueke=@xueke,ke=@ke,";
strSQL += "stStatus=@stStatus,haveStPhoto=@haveStPhoto,zhidu=@zhidu";
OleDbParameter[] parameters = {
new OleDbParameter("@GradeName", OleDbType.VarChar,200),
new OleDbParameter("@GradeYear", OleDbType.VarChar,200),
new OleDbParameter("@xuenian", OleDbType.VarChar,10),
new OleDbParameter("@xueqi", OleDbType.VarChar,10),
new OleDbParameter("@Dormitory", OleDbType.VarChar,100),
new OleDbParameter("@xueke", OleDbType.VarChar,100),
new OleDbParameter("@ke", OleDbType.VarChar,255),
new OleDbParameter("@stStatus", OleDbType.VarChar,200),
new OleDbParameter("@haveStPhoto", OleDbType.Boolean,2),
new OleDbParameter("@zhidu", OleDbType.LongVarChar,5000),
};
parameters[0].Value = txbGradeName.Text;
parameters[1].Value = txbGradeYear.Text;
parameters[2].Value = ddlXuenian.SelectedValue;
parameters[3].Value = ddlXueqi.SelectedValue;
parameters[4].Value = txbDormitory.Text;
parameters[5].Value = txbXueke.Text;
parameters[6].Value = txbKe.Text;
parameters[7].Value = txbStStatus.Text;
if (rblStPhoto.SelectedValue == "True")
parameters[8].Value = true;
else
parameters[8].Value = false;
parameters[9].Value = Request.Form["content1"];
int cmdResult = GetExcuteNonQuery(strSQL, parameters);
if (cmdResult == 1)
MsgBox("修改成功!", "Config.aspx");
}
********************************************************************
GetExcuteNonQuery()的程序如下:
&