Subject Re: [IBO] IBOQuery - Query Editor
Author Lester Caine
mitch_landor wrote:

> --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
>>>3. In the InsertSQL window I want to pass the grid row values back
>>>into the database for an insert. How do I reference the new grid
>>>values to be inserted?
>>
>>USE PARAMETERS !!!!!!!!!!!!!
>>
>>>insert into PROJ (remark, created, createdby, lockd, lockdby)
>>> values (:remark, :created, :createdby, :lockd, :lockdby)
>>
>>Of course, you'd better have a key in there somewhere, too!!
>
> I have examined the Tech Info Sheets and purchased the Getting Started
> Guide. I can't seem to find anywhere (not even in Delphi) any code
> that indicates how to get the values from a new row in a Tdbgrid into
> the database.
IBO handles a lot of this automatically - as long as you let it.

> Also I have a primary key field called "ID" which has a before insert
> generator trigger to create the next ID. What SQL code should I use to
> construct this update SQL if I am using TIBOQuery & TIBODatabase?
The trigger is just a backup, and is actually part of your problem. You
do not know WHICH record you have just inserted.
Look at GeneratorLinks - in TIBOQuery. This will tell IBO which
generator to use, and it will get a value for the ID *BEFORE* it does
the insert. So that it can then display the record when it has been
inserted. If you are not letting IBO do this automatically, then YOU
should read the next ID, save it as part of the insert, and then you can
select the new record using the ID.

> Thanks for your help. I'm sure once I can get started with this it'll
> go a lot easier.
The main problem is simply letting IBO get on with things. So many
people have existing code to 'get round problems' which IBO simply does
not need.
Personally I found that starting 'clean' and ignoring the TIBO stuff was
a lot easier than trying to convert to that. TIB_ native stuff is very
powerful ;)

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.