A
ahwui
Unregistered / Unconfirmed
GUEST, unregistred user!
我正在做一个修改密码的程序,前面的验证等都没错,
但在更新数据库之后就出现如下提示
“Project abc.exe raised execption class ENoResultSet with message 'Error Creating cursor handle'.”
数据库更新操作已经成功。
部分源程序:
procedure TPasswordForm.Button1Click(Sender: TObject);
var username,UPwd,UPwdNew,UPwdConf:string;
sqlResult:integer;
begin
username:='bruce';
UPwd:=PwdNow.text;
UPwdNew:=PwdNew.text;
UPwdConf:=PwdConf.text;
if (UPwd = '') or (UPwdNew = '') or (UPwdConf = '') or (UPwdNew <> UPwdConf) then
begin
MessageDlg('输入不正确。', mtInformation,[mbOk], 0);
exit;
end;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select count(EmployeeID) from tblValidate where UserName='''+username+''' and Pswd='''+UPwd+'''');
Query1.Open;
sqlResult:=StrToInt(Query1.Fields[0].AsString);
if sqlResult=0 then
begin
MessageDlg('输入的现用密码错误!', mtInformation,[mbOk], 0);
PwdNow.SetFocus;
exit;
end
else
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update tblValidate set Pswd='''+UPwdNew+''' where UserName='''+username+'''');
Query1.Open;
MessageDlg('密码修改成功!', mtInformation,[mbOk], 0);
end;
end;
但在更新数据库之后就出现如下提示
“Project abc.exe raised execption class ENoResultSet with message 'Error Creating cursor handle'.”
数据库更新操作已经成功。
部分源程序:
procedure TPasswordForm.Button1Click(Sender: TObject);
var username,UPwd,UPwdNew,UPwdConf:string;
sqlResult:integer;
begin
username:='bruce';
UPwd:=PwdNow.text;
UPwdNew:=PwdNew.text;
UPwdConf:=PwdConf.text;
if (UPwd = '') or (UPwdNew = '') or (UPwdConf = '') or (UPwdNew <> UPwdConf) then
begin
MessageDlg('输入不正确。', mtInformation,[mbOk], 0);
exit;
end;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('select count(EmployeeID) from tblValidate where UserName='''+username+''' and Pswd='''+UPwd+'''');
Query1.Open;
sqlResult:=StrToInt(Query1.Fields[0].AsString);
if sqlResult=0 then
begin
MessageDlg('输入的现用密码错误!', mtInformation,[mbOk], 0);
PwdNow.SetFocus;
exit;
end
else
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('update tblValidate set Pswd='''+UPwdNew+''' where UserName='''+username+'''');
Query1.Open;
MessageDlg('密码修改成功!', mtInformation,[mbOk], 0);
end;
end;