Subject Re: [IBO] TIB_UpdateBar problem ...
Author Helen Borrie
At 11:08 PM 04-05-01 -0500, you wrote:

>Hi there,
>I'm learning IBObjects following the Getting Started manual; I'm in the
>"Working the ropes" section, and following every step, but using my own
>Interbase tables and prepared IB queries. I have a normal TIB_Grid with a
>TIB_Navigation bar that works just fine. The point is that when assigning
>the TIB_UpdateBar linked to the same TIB_Query as the grid and navigation
>bar, all buttons are disabled ... why? I have not changed any property
>values and the query is Active in design and run time. My query is:
>I have set "t.DESCRIPCIONTIPOPROV" as readonly in the TIB Query component.

For a select query over one table, normally setting RequestLive to True will make your dataset updatable. (This is not the same as "active" - a query that is open is active, whether or not it is updatable).

Even so, for the query to be live, you must set its KeyLinks property to a column or group of columns that uniquely distinguishes a row. For the single table query, this will be the primary key of the underlying table.

This query is not "updatable" because it involves a join. That is why the update bar has all its buttons disabled. Even if you set RequestLive to True, it will not be updatable. (notice, also, that the syntax of this statement is incorrect - you need to include the table alias identifiers for each column, whereas you have omitted some.)

The good news is that in IBO you can make almost any query updatable. Amongst the properties of the query, you will find the EditSQL, InsertSQL and DeleteSQL properties. Into each of these, insert a statement that will perform the changes you require.

Be aware that you can update only one table in your joined structure. Determine which table this should be and enter it in the KeyRelation property.

You will again need to set a Keylinks that uniquely distinguishes a row. Sometimes, you can do this with the two primary keys; it really depends on your structures.

If you need to update both tables, write stored procedures for the edit, insert and delete operations you require. Place EXECUTE statements in the EditSQL, InsertSQL and DeleteSQL properties in this case, to make the dataset live (i.e. updatable).

I would not recommend using the FOR UPDATE clause with dynamic SQL.


All for Open and Open for All
InterBase Developer Initiative ยท