ADO Delphi 5



         

.


.

BatchCB TCheckBox

ApplyButton TButton

CancelButton TButton

OnClick .

OnActivate .

procedure TForm1.FormActivate(Sender: TObject);

begin

fix_controls;

ApplyButton.Visible := BatchCB.State = cbChecked;

CancelButton.Visible := BatchCB.State = cbChecked;

end;

procedure TForm1.BatchCBClick(Sender: TObject);

begin

MasterSQL.Close;

DetailSQL.Close;

if BatchCB.State = cbChecked then

begin

MasterSQL.LockType := ltBatchOptimistic;

DetailSQL.LockType := ltBatchOptimistic;

end

else

begin

MasterSQL.LockType := ltOptimistic;

DetailSQL.LockType := ltOptimistic;

end;

MasterSQL.Open;

DetailSQL.Open;

ApplyButton.Visible := BatchCB.State = cbChecked;

CancelButton.Visible := BatchCB.State = cbChecked;

end;

procedure TForm1.ApplyButtonClick(Sender: TObject);

begin

MasterSQL.UpdateBatch;

DetailSQL.UpdateBatch;

end;

procedure TForm1.CancelButtonClick(Sender: TObject);

begin

MasterSQL.CancelBatch;

MasterSQL.CancelBatch;

end;