Hello ,
I use Delphi 5 + Midas + DOA 4.0.5.0。
Autocommit=False;
When I use TClientDataset.applyupdates(-1), Client data will write to database succefully in time.
but When I use SQL in TClientdateset , transaction will not auto commit and after I quit my application then commit.
Please see the code:
procedure TfrmTrack.btnUpdateClick(Sender: TObject);
var
sSQL:string;
begin
sSQL:='update Table_A set flag=''OK'' where mpsmonth='092004';
with dmMain.cdPublic do
begin
commandText:=sSQL;
Execute;
end;
end;
As the above code can not commit the transaction in time , So I change it, Please below:
procedure TfrmTrack.btnUpdateClick(Sender: TObject);
var
sSQL:string;
begin
sSQL:='BEGIN update Table_A set flag=''OK'' where mpsmonth='092004'; commit; end;';
with dmMain.cdPublic do
begin
commandText:=sSQL;
Execute;
end;
end;
Yes, It seems that I solved the problem , But I don't know if still have a good way to do it . Please give me advice. Thanks.
I use Delphi 5 + Midas + DOA 4.0.5.0。
Autocommit=False;
When I use TClientDataset.applyupdates(-1), Client data will write to database succefully in time.
but When I use SQL in TClientdateset , transaction will not auto commit and after I quit my application then commit.
Please see the code:
procedure TfrmTrack.btnUpdateClick(Sender: TObject);
var
sSQL:string;
begin
sSQL:='update Table_A set flag=''OK'' where mpsmonth='092004';
with dmMain.cdPublic do
begin
commandText:=sSQL;
Execute;
end;
end;
As the above code can not commit the transaction in time , So I change it, Please below:
procedure TfrmTrack.btnUpdateClick(Sender: TObject);
var
sSQL:string;
begin
sSQL:='BEGIN update Table_A set flag=''OK'' where mpsmonth='092004'; commit; end;';
with dmMain.cdPublic do
begin
commandText:=sSQL;
Execute;
end;
end;
Yes, It seems that I solved the problem , But I don't know if still have a good way to do it . Please give me advice. Thanks.