日期:2014-05-17  浏览次数:20792 次

C#路过的大神帮看看
  原密码:
  新密码:
确认密码:

            String password = this.textBox1.Text;
            String password1 = this.textBox2.Text;
            String password2 = this.textBox3.Text;
            
            String cnno = "Data Source=HP-PC;Initial Catalog=FIRST;Integrated Security=True;Pooling=False";
            SqlConnection connection = new SqlConnection(cnno);
            /*string sql = string.Format("select * from Logind where Uname='{0}'and Upw='{1}'and Ujb='{2}'", name, password, ji);原来登录使用*/
            connection.Open();
            SqlCommand command = new SqlCommand(sql, connection);
            int num = Convert.ToInt32(command.ExecuteScalar());
怎么将数据库中密码修改成新密码。。。求大神
------最佳解决方案--------------------

if(!password1.Equals(password2))
{
MessageBox("两次密码输入不一致");
return;
}
string sql = string.Format("update Logind set Upw='{3}' where Uname='{0}'and Upw='{1}'and Ujb='{2}'", name, password, ji,password1);

------其他解决方案--------------------
使用update语句就可以了。

同意楼上的,密码怎么都md5一把。
------其他解决方案--------------------
看起来更新Upw字段就可以,这个数据库设计太差,密码用明码保存,呵呵,
------其他解决方案--------------------
使用update语句
------其他解决方案--------------------
引用:
看起来更新Upw字段就可以,这个数据库设计太差,密码用明码保存,呵呵,
小弟新手,用来练练手,还请多多指点。应该怎么修改明码呢
------其他解决方案--------------------
直接将取出来的密码字段  通过调用MD5的加密方法,取返回值再更新到数据库就是了~~~~
------其他解决方案--------------------
引用:
C# code?123456if(!password1.Equals(password2)){MessageBox("两次密码输入不一致");return;}string sql = string.Format("update Logind set Upw='{3}' where Uname='{0}'and Upw='{1}'and Ujb='{2}'", name, ……
按你的改了,不过有点问题。。就是不管我输什么原密码都可以改密码