delphi ADOQuery查询更改用户

procedure TForm1.bt_deleteClick(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('delete from user where id='''+Edit1.Text+''' and password='''+Edit2.Text+'''');
  ADOQuery1.ExecSQL;
  Edit1.Clear;
  Edit2.Clear;
  showMessage('删除成功');
end;


procedure TForm1.bt_changeClick(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('update user set password='''+Edit2.Text+''' where id='''+Edit1.Text+'''');
  ADOQuery1.ExecSQL;
  Edit1.Clear;
  Edit2.Clear;
  showMessage('更改成功');
end;

都是一个套路,理解了就会写了

你可能感兴趣的:(Delphi)