generator return value not set

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Re: generator return value not set

Post by inageib » Thu 06 Dec 2012 14:23

Many thanks for explaining this to me

to complete the thread a found a solution to use the following code in the component "After Insert" event

Code: Select all

 IBCQuery1.Close;
 IBCQuery1.SQL.Clear;
 IBCQuery1.SQL.Add('SELECT NEXT VALUE FOR GEN_table1_deptno from RDB$DATABASE');
 IBCQuery1.Open;

 IBCQuery1.fieldbyname('deptno').asinteger := IBCQuery1.Fields[0].AsInteger;
it work correctly and I dont need the generator but in multi user network does other users will see the new correct value of deptno ? in other meaning does the deptno will increase correctly in mutli-user ?

AndreyZ

Re: generator return value not set

Post by AndreyZ » Thu 06 Dec 2012 16:19

In your first post, you wrote that you have triggers for each field in the dataset. If by 'trigger' you mean that you want to obtain new values for several fields manually by using generators, you can use the same approach that I gave you at http://forums.devart.com/viewtopic.php?f=24&t=20603
You can use generators in the multi-users environment. Each time you call it, the generator will give a new unique value.

Post Reply