更新语句有关问题
更新语句问题
string newpass
newpass=sle_5.text
update acc_pass
set password=:newpass
where acc_pass.Password=:sle_3.text;
//using sqlca;
if sqlca .sqlcode<0 then
messagebox("","")
end if
commit;
执行后
数据库没有更新,求帮助
------解决方案--------------------
试下下面的代码吧,应当能解决你的问题,不过偶对你的设计有点疑惑,你的系统里只有密码没有用户名吗?难道是单用户软件?
string newpass
newpass=sle_5.text
update acc_pass
set password=:newpass
where acc_pass.Password=:sle_3.text;
//using sqlca;
if sqlca .sqlcode<0 then
messagebox("","")
end if
commit;
执行后
数据库没有更新,求帮助
------解决方案--------------------
试下下面的代码吧,应当能解决你的问题,不过偶对你的设计有点疑惑,你的系统里只有密码没有用户名吗?难道是单用户软件?
- C# code
String ls_OldPassword String ls_NewPassword String li_Count ls_OldPassword = sle_3.Text ls_NewPassword = sle_5.Text SELECT COUNT(*) INTO :li_Count FROM ACC_PASS WHERE PASSWORD = :ls_OldPassword; If SQLCA.SQLCode = -1 Then MessageBox("error", "") Return End If If li_Count = 0 Then MessageBox("提示", "原始密码错误,更改密码失败!") Return End If update acc_pass set password=:ls_NewPassword where acc_pass.Password=:ls_OldPassword; If SQLCA.SQLCode = -1 Then MessageBox("error", "") Return End If COMMIT ;