Subject Re: [IBO] iboTDataset
Author Helen Borrie
At 04:51 AM 13/03/2006, you wrote:
>Hello Everyone,
>I need something very simple but I can't get it right. I've learned
>not to fight something too long before asking when there are always
>people willing and able to help.
>All I want to do is be able to edit a Firebird table with Almediadev's
>BusinessSkinForm DB controls wich are TDataset descendants. When using
>a TIBOTable as dataset I can edit just fine but I can't order the
>records they way I want. When I use a TIBOQuery component I can
>obviously sort but I can't edit ­ by navigator bar's editing buttons
>remain greyed.
>First prize would be to skin the TIB_XXX editing controls but I'm not
>an artist neither do I have time to create skins. Maybe somebody has
>done so?
>Any help will be appreciated.

The problem here appears to be that you are not
providing a "live" dataset to your control.

To be "editable", any dataset must "live". By
nature, there is no such thing as "a live
dataset" over a client/server database. Dataset
objects do stuff under the hood to translate
edit/insert/delete requests on a dataset row into
DML statements that it constructs and sends over
the wire when the application "posts" an e/i/d request.

In order for a dataset to behave as though it
were "live", it has to have two essential things:

1) Valid KeyLinks that uniquely identify the rows in the dataset
2) One DML statement to realise the dataset's
insert/edit/delete requests as DML statements at Post time.

What *you* have to do depends on the query.

-- The simple case is a dataset that is the
output of a simple SELECT on one table. For this
case, you need the primary key of the table to be
in the set and you set KeyLinksAutodefine
true. The dataset will then take care of setting
the KeyLinks itself. To make the dataset live,
set the RequestLive property true. (By default,
it is false.) The dataset then has everything it
needs to construct parameterised DML statements
for the InsertSQL, EditSQL and DeleteSQL properties.

-- The less simple case is a dataset that is the
output of joins or of a selectable stored
procedure. In this case, you have to have at
least the primary keys of each joined table in
the KeyLinks that you want to be updatable. And
you need to design the parameterised InsertSQL,
EditSQL and DeleteSQL statements
yourself. (RequestLive then becomes irrelevant.)

And the other thing to know when using IBO is
that the IBO components don't open automagically
by default as the VCL components do. You have to
open them in code. This goes for tiboconnection
(tibodatabase) as well as your statement objects
(tibotable and tiboquery). This is "by design",
since opening an application with umpteen open
datasets consumes a lot of wire
capacity. Client/server workflow needs to be
designed to respond to the needs and
environmental conditions of users, not programmer convenience.

If you want the VCL TDataset behaviour, of
opening everything by default (not recommended,
except for design-time convenience), you can set
the StoreActive property of the IB_Session true.