熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Delphi編程 >> 正文

主從表的添加保存處理實現方法

2022-06-13   來源: Delphi編程 

  首先設置AQmain datasource
AQDetail Datasource
AQDetaildatasource := Datasource
AQDetaillocktype := ltBatchOptimistic

  procedure TFormFormCreate(Sender: TObject);
begin
if not AQMainactive then AQMainopen;
if not AQDetailActive then AQDetailOpen;
end;

  procedure TFormButtonClick(Sender: TObject);
begin
AQMainPost;
end;

  procedure TFormAQMainAfterPost(DataSet: TDataSet);
begin
AQDetailUpdateBatch();
AQDetailDataSource := DataSource ;
end;

  procedure TFormButtonClick(Sender: TObject);

  begin
AQMainAppend ;
AQMainFieldByName(Adate)value := datetostr(date());

  end;

  procedure TFormAQMainAfterInsert(DataSet: TDataSet);
begin
AQDetailDataSource := nil;
end;

  procedure TFormAQDetailAfterInsert(DataSet: TDataSet);
begin
AQDetailFieldByName(mgrno)value:=AQMainFieldByName(mgrno)value;
end;


From:http://tw.wingwit.com/Article/program/Delphi/201311/24679.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.