Subject Re: [IBO] Determine table's key value after post
Author Nols Smit
I did what you proposed but somehow, for each record inserted the generator increments with 2.

Nols Smit
----- Original Message -----
From: Helen Borrie
Sent: 08 May, 2005 12:05 AM
Subject: Re: [IBO] Determine table's key value after post

At 09:31 PM 7/05/2005 +0200, you wrote:
>I'm using an IBODatabase and IBOQuery components in an IntraWeb
>application interfacing with a FireBird database. I'm using a Generator
>and a Triger to generate the keys of the table. What is the best way to
>get hold of the generated key value in the AfterPost event of the IBOQuery?

There is no way to get it *after* the post. The trick is to get it
*before*, using GeneratorLinks.

Write the trigger in such a way that it will only fire if no value is
passed to it, i.e.

create trigger xx for yy active before insert
if (new.ID is null) then
new.ID = gen_id(gen_yy, 1);

Then, in your IBOQuery, set GeneratorLinks:


or set it globally in the GeneratorLinks property of your connection object:


You can read the value into a variable in the BeforePost event.


IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________ - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Yahoo! Groups Links

a.. To visit your group on the web, go to:

b.. To unsubscribe from this group, send an email to:

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

[Non-text portions of this message have been removed]