protected void submit_Click(object sender, EventArgs e)
{
if (text.Text != "")
{
if (display.Checked == true)
{
string nowTime = DateTime.Now.ToString("yyyy-MM-dd");
if (check01.Text == "1")
{
run.operateData("update notice set text='" + text.Text + "',time='" + nowTime + "',display='1是' where id=" + editID, -1, 0);
run.operateData("update notice set display='是' where id=" + editID, -1, 0);
Response.Write("<script>alert('修改成功!');window.location = 'noticeManage.aspx';</script>");
check01.Text = "0";
}
else
{
run.operateData("insert into notice (text,time,display) values ('" + text.Text + "','" + nowTime + "','是')", -1, 0);
Response.Write("<script>alert('添加成功!');window.location = 'noticeManage.aspx';</script>");
}
}
else
{
string nowTime = DateTime.Now.ToString("yyyy-MM-dd");
if (check01.Text == "1")
{
run.operateData("update notice set text='" + text.Text + "',time='" + nowTime + "',display='0否' where id=" + editID, -1, 0);
run.operateData("update notice set text='" + text.Text + "'" +" where id=" + editID, -1, 0);
Response.Write("<script>alert('修改成功!');window.location = 'noticeManage.aspx';</script>");
check01.Text = "0";
}
else
{
run.operateData("insert into notice (text,time,display) values ('" + text.Text + "','" + nowTime + "','否')", -1, 0);
Response.Write("<script>alert('添加成功!');window.location = 'noticeManage.aspx';</script>");
}
}
}
else Response.Write("<script>alert('通告内容不能为空!')</script>");
}
oprerateDate是操作数据库,那个update的sql语句 点击按钮后 提示修改成功,但是数据库 内容没有改变,也没有报错
没有报错首先要看run.operateData这个方法执行了没有,这个方法里的实现代码是什么,有没有try catch跳过了异常。如果以上都没有问题,就检查你写入的数据库和你现在打开看的是不是一个数据库。