Subject Re: Cannot edit a TIB_Query if there is INNER JOIN at SQL
Author Marco Menardi
--- In, Andrei Luís
<> wrote:
> Hi, it's me again... :-)
> I'm using INNER JOIN in a TIB_Query that I use to show the data in a
> form, and, in this form, I want to allow editing and inserting. But,
> I'm getting error messages "Cannot edit record" and "Cannot insert
> record".
> I want to edit only fields of "from" clause, not the fields that INNER
> JOIN brings.
> If I remove INNER JOIN from SQL, insert and edit work fine.
> Is this a Firebird feature? Is this an IBO feature? Or is this a
> If so, whats the solution? Do I need to do the join using where? Or
> should I use sub-selects?
> []s
> Andrei
> W2K + D4 Pro + FB 1.5.2 + IBO 4.5B

I've found a post of Helen by 2002 in my notes, so I paste it here for
your convenience:
IBO does update and insert and implicitly for you in the background,
provided your dataset is updatable (in SQL terms). If a dataset is
updatable then simply setting RequestLive to True will make editing
available - provided your KeyLinks are correct.

If not (i.e. you have a joined dataset and you want to operate on
multiple tables) you still can make your dataset "live" (updatable) by
providing SQL statements in the InsertSQL, EditSQL and DeleteSQL
properties. As a general rule, these statements will be EXECUTE calls
to stored procedures which accept your dataset's KeyLinks as separate
input parameters (along with any other parameters you want to pass...)
I don't use procedures in these cases, but just plain update command
to the "main" table.
If you use the query editor, you have, in the UpdateSQL tab, two
buttons, "Generate for table" and "Generate for procedure" that can
generate the code automagically for you.
The paramount thing with joins is that you provide IBO an unique way
to identify records, so pay attention to the KeyLinks tab as well.
Finally, if you are a novice, the "Getting started guide" and maybe
the tech sheets in the IBO site can help you, expecially the "RAD with
IBO" one ;)
best regards
Marco Menardi