Query1.Close; Query1.SQL.Clear; Query1.SQL.Add('select * from dlb.db'); Query1.SQL.Add('where code=:code'); Query1.ParamByName('code').AsString:=ecode.Text ; Query1.open; if Query1.RecordCount=0 then ShowMessage('the code is wrong'); if Query1.FieldByName('pass').AsString <> epass.Text then ShowMessage('then pass is wrong'); if npass.Text <> rnpass.Text then showmessage ('两次输的的新密码不一致'); Query1.Close; Query1.SQL.Clear; Query1.SQL.Add('update dlb.db set pass=:pass where ...'); Query1.ParamByName('pass').AsString:=npass.Text; Query1.ExecSQL;
Query1.SQL.Clear;
Query1.SQL.Add('select * from dlb.db');
Query1.SQL.Add('where code=:code');
Query1.ParamByName('code').AsString:=ecode.Text ;
Query1.open; if Query1.RecordCount=0 then
ShowMessage('the code is wrong');
if Query1.FieldByName('pass').AsString <> epass.Text then
ShowMessage('then pass is wrong');
if npass.Text <> rnpass.Text then
showmessage ('两次输的的新密码不一致');
Query1.Close; Query1.SQL.Clear;
Query1.SQL.Add('update dlb.db set pass=:pass where ...');
Query1.ParamByName('pass').AsString:=npass.Text;
Query1.ExecSQL;
or
query1.close;
query1.open;