dd

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/abclm/article/details/6455806
procedure TSetForm.SavebtClick(Sender: TObject);
begin
  with DataFrm.ADOQuery do
  begin
    Close;
    SQL.Clear;
    SQL.Add('Select * From GameScript Where ID = 1');
    Open;
    if DataFrm.ADOQuery.RecordCount = 0 then
    begin
      Append;
      FieldbyName('FHP').Value:=trim(HPEdit1.text);
      FieldbyName('FMP').Value:=trim(MPEdit1.text);
      FieldbyName('PHP').Value:=trim(HPEdit2.text);
      FieldbyName('PMP').Value:=trim(MPEdit2.text);
      Post;
    end
    else
      begin
        Close;
        SQL.Clear;
        SQL.Add('Update GameScript Set FHP=''' + trim(HPEdit1.text) + ''',FMP=''' + trim(MPEdit1.text) + ''',PHP=''' + trim(HPEdit2.text) + ''',PMP=''' + trim(MPEdit2.text) + ''' Where ID = 1');
        ExecSQL;
      end;
  end;
  SetForm.Close;
end;

 
展开阅读全文

没有更多推荐了,返回首页