Subject | Re: [IBO] Generator links property |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-03-23T03:08:08Z |
At 11:26 PM 22-03-02 -0300, you wrote:
(1) Using IB_SQL you can set it directly by clicking on the Generators tab
in the browser and changing the number
(2) In SQL: select Gen_ID(MyGenerator, 1) from RDB$Database
Inside your IBO application it is not recommended *ever* to change the
generator value except by taking the next number as a GeneratorLink or by
calling Gen_ID() method of the connection or dataset object.
If you use GeneratorLinks, it will be automatic. If you need to know the
number in your application before the inserted row is posted, you can read
the current value of the column at any event after the Insert call, e.g.
AfterInsert.
If you use the Gen_ID method you must do it explicitly in your code - in
this case DO NOT USE GENERATORLINKS. You can return the Gen_ID() result
into an integer variable in the BeforeInsert event and then assign it to
the column (and any other things you want to do with it) during the Edit
phase...any time before Post is called.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com
>How can I set the number?Outside your application:
(1) Using IB_SQL you can set it directly by clicking on the Generators tab
in the browser and changing the number
(2) In SQL: select Gen_ID(MyGenerator, 1) from RDB$Database
Inside your IBO application it is not recommended *ever* to change the
generator value except by taking the next number as a GeneratorLink or by
calling Gen_ID() method of the connection or dataset object.
If you use GeneratorLinks, it will be automatic. If you need to know the
number in your application before the inserted row is posted, you can read
the current value of the column at any event after the Insert call, e.g.
AfterInsert.
If you use the Gen_ID method you must do it explicitly in your code - in
this case DO NOT USE GENERATORLINKS. You can return the Gen_ID() result
into an integer variable in the BeforeInsert event and then assign it to
the column (and any other things you want to do with it) during the Edit
phase...any time before Post is called.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com