Subject | generator increments by 3 |
---|---|
Author | René J. Belland |
Post date | 2003-12-30T06:03:28Z |
Hi,
I have a TIBOQuery with the following sql:
select gen_id(lotidgen, 1) from rdb$database
Am using the following components in an simple test application:
IBOQuery1: TIBOQuery;
IBOTransaction1: TIBOTransaction;
IBOQuery1GEN_ID: TLargeintField;
Button1: TButton;
Label1: TLabel;
IB_Connection1: TIB_Connection;
IB_Session1: TIB_Session;
I have a button event with the code:
var
num : int64;
begin
if IBOQuery1.active then
IBOQuery1.active := false;
IBOTransaction1.StartTransaction;
try
IBOQuery1.active := true;
num := IBOQuery1GEN_ID.aslargeint;
label1.caption := inttostr(num);
except
IBOTransaction1.Rollback;
raise;
end;
IBOTransaction1.Commit;
end;
When I run the program, the generator is incremented by 3 each time I click
the button. Why is this?
If I use a TIBODatabase and use it to control the transaction, then the
generator increments properly (ie, by one each time).
Should a TIB_Connection component not be used with the Tdataset compatible
components?
Thanks.
René
I have a TIBOQuery with the following sql:
select gen_id(lotidgen, 1) from rdb$database
Am using the following components in an simple test application:
IBOQuery1: TIBOQuery;
IBOTransaction1: TIBOTransaction;
IBOQuery1GEN_ID: TLargeintField;
Button1: TButton;
Label1: TLabel;
IB_Connection1: TIB_Connection;
IB_Session1: TIB_Session;
I have a button event with the code:
var
num : int64;
begin
if IBOQuery1.active then
IBOQuery1.active := false;
IBOTransaction1.StartTransaction;
try
IBOQuery1.active := true;
num := IBOQuery1GEN_ID.aslargeint;
label1.caption := inttostr(num);
except
IBOTransaction1.Rollback;
raise;
end;
IBOTransaction1.Commit;
end;
When I run the program, the generator is incremented by 3 each time I click
the button. Why is this?
If I use a TIBODatabase and use it to control the transaction, then the
generator increments properly (ie, by one each time).
Should a TIB_Connection component not be used with the Tdataset compatible
components?
Thanks.
René