con.Open();
string uuser = "Update users set userpwd='"+txtnewpwdtwo.Text+"' where username='" + txtuusername.Text + "'and userpwd='" + txtuuserpwd.Text + "'and usercid = '"+txtuusercid.Text+"'";
SqlCommand cmd = new SqlCommand(uuser, con);
cmd.ExecuteNonQuery();
Label1.Text = "<script>alert('修改密码成功!')</script>";看是没问题但是我点击按钮修改密码的时候发先第二个条件'and usercid = '"+txtuusercid.Text+"'";和数据库不匹配也会会弹出说修改密码成功,还好数据库是没改的。这咋办。麻烦老大门清楚点告诉我
string uuser = "Update users set userpwd='"+txtnewpwdtwo.Text+"' where username='" + txtuusername.Text + "'and userpwd='" + txtuuserpwd.Text + "'and usercid = '"+txtuusercid.Text+"'";
SqlCommand cmd = new SqlCommand(uuser, con);
cmd.ExecuteNonQuery();
Label1.Text = "<script>alert('修改密码成功!')</script>";看是没问题但是我点击按钮修改密码的时候发先第二个条件'and usercid = '"+txtuusercid.Text+"'";和数据库不匹配也会会弹出说修改密码成功,还好数据库是没改的。这咋办。麻烦老大门清楚点告诉我
解决方案 »
- gridview 固定多行表头如何固定 ,表头的融合是在.cs中写的
- 急~~正则表达式问题
- |zyciis| 如何最好的判断context.Request.RawUrl指定的地方是否在/Upload/Material/目录中的对像,谢谢
- 真恶心!病毒?两个线程还是共用同个SESSION~~~
- 请问水晶报表的交叉报表如何做分组小计.
- 讲所选的条目绑定到repeater控件,如何实现!
- 这样的水平,在上海能拿几k?
- 在新闻系统如何做的任意位置插图片?
- 用webmatrix做完了页面,要如何发布。
- 大虾帮忙:如何给DataList的EditTemplate里的一个DropDownList梆定数据?
- 如何实现页面视屏播放
- 正则表达式,不剔除正负号。
应该写在条件里面 if(修改成功){ Label1.Text = " <script>alert('修改密码成功!') </script>";
}
连判断都没有一定会执行的
Label1.Text = " <script>alert('修改密码成功!') </script>"; cmd.ExecuteNonQuery(); 执行后你应该判断一下是否有影响的行数..
如果有再提示..
要不就会出现你现在的结果..
string uuser = "Update users set userpwd='"+txtnewpwdtwo.Text+"' where username='" + txtuusername.Text + "'and userpwd='" + txtuuserpwd.Text + "'and usercid = '"+txtuusercid.Text+"'";
SqlCommand cmd = new SqlCommand(uuser, con);
int val= cmd.ExecuteNonQuery();
if(val>0)
Label1.Text = " <script>alert('修改密码成功!') </script>";
else
Label1.Text = " <script>alert('error!') </script>";
if(cmd.ExecuteNonQuery()>0)
{
//执行成功
}
con.Open();
string uuser = "Update users set userpwd='"+txtnewpwdtwo.Text+"' where username='" + txtuusername.Text + "'and userpwd='" + txtuuserpwd.Text + "'and usercid = '"+txtuusercid.Text+"'";
SqlCommand cmd = new SqlCommand(uuser, con);
int i = cmd.ExecuteNonQuery();
if(判断i){
Label1.Text = " <script>alert('修改密码成功!') </script>";}
else{}
<script>alert('修改密码成功!') </script> 括号后面有个分号
var iReslut = cmd.ExecuteNonQuery();
if(iReslut == 1)Label1.Text = " <script>alert('修改密码成功!') </script>";
string uuser = "Update users set userpwd='"+txtnewpwdtwo.Text+"' where username='" + txtuusername.Text + "'and userpwd='" + txtuuserpwd.Text + "'and usercid = "+txtuusercid.Text;