ADO Delphi 5



         


TADOConnection.

(StCmButton RollbackButton) TButton, OnClick , fix_controls , OnActivate

 

 

type

TForm1 = class(TForm)

private

procedure fix_controls;

procedure TForm1.fix_controls;

begin

if Connection.InTransaction then

begin

StCmButton.Caption := 'Commit';

RollbackButton.Enabled := True;

end

else

begin

StCmButton.Caption := 'Begin';

RollbackButton.Enabled := False;

end;

MasterSQL.Requery;

DetailSQL.Requery;

end;

procedure TForm1.StCmButtonClick(Sender: TObject);

begin

if not Connection.InTransaction

then Connection.BeginTrans

else Connection.CommitTrans;

fix_controls;

end;

procedure TForm1.RollbackButtonClick(Sender: TObject);

begin

Connection.RollbackTrans;

fix_controls;

end;

procedure TForm1.FormActivate(Sender: TObject);

begin

fix_controls;

end;

. Trans.

, , .