asp.net更新数据提示成功,但是没有更新数据库
string name1 = TextBox1.Text.ToString();
string sex1 = TextBox2.Text.ToString();
string email1 = TextBox3.Text.ToString();
try
{
string sql1 = "update usertable set usersex='" + sex1 + "',useremail='" + email1 + "' where username='" + name1 + "'";
SqlConnection conn = new SqlConnection();
SqlCommand cmd = DB.command(sql1);
int i = DB.command(sql1).ExecuteNonQuery();
if (i > 0)
Response.Write("<script>alert('信息修改成功');window.location='gerenzhongxin.aspx'</script>");
else
Response.Write("<script>alert('失败!')</script>");
}
catch
{
Response.Write("<script>alert('失败!')</script>");//提示错误
}
大神们帮忙看看,是哪里写错了吗