begin
ADOQuery1.close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select password from userinfo where username='''+label2.Caption +'''';
Adoquery1.open;
if  edit1.Text<>Adoquery1.Fields[0].AsString then
begin
 Application.MessageBox('原密码不正确','警告',MB_ICONWARNING);
 exit;
end;
if ((trim(edit2.Text)='') or (trim(edit3.text)='') )then
begin
Application.MessageBox('新密码和确认密码不能为空','警告',MB_ICONWARNING);
exit
end;
if edit2.Text<>edit3.text then
begin
Application.MessageBox('两次密码不一致','警告',MB_ICONWARNING);
exit;
end;
      begin
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      ADOQuery1.SQL.text:='update userinfo set password='''+edit2.text+''' where username='''+Label2.Caption+'''';
      ADOQuery1.ExecSql;
      application.MessageBox('成功修改密码','成功',mb_iconwarning);
      exit;
      end;
end;
end.

解决方案 »

  1.   

    请求大侠们帮助 小女子初学delhi 各位走过路过的大侠们 帮帮我吧!
      

  2.   

    ADOQuery1.SQL.text:='update ............把这里的 ADOQuery1.SQL.text 的值复制出来放到数据库运行一下看看问题在哪里。
      

  3.   

     ADOQuery1.SQL.text:='update userinfo set [password]='''+edit2.text+''' where [username]='''+Label2.Caption+'''';
    不过还是要谢谢上面的大侠
      

  4.   

    ADOQuery1.SQL.text:='update userinfo set [password]='+QuotedStr(edit2.text)+' where [username]='+QuotedStr(Label2.Caption);
    这样写会比较清晰,建议使用QuotedStr函数,这个函数很好用的