Subject Re: [IBO] Two or more tables...
Author Helen Borrie

At 03:16 PM 4/12/2005 -0800, you wrote:
>Dear Helen,
>Helen Borrie <helebor@...> wrote:
>1) What are the two SQL statements?

There is total confusion here. Originally you said
"I´m using a tib_query for each table"

To use tib_query, you must have a SELECT statement in the SQL property, for

END, <-------------------- see my note about this

The SELECT statement defines your dataset, i.e. the structure of each row
that is returned to the ib_query.

[[ Note about END: you should check this table to see whether the
identifier of this column is "END". The word END (without double quotes)
is not a legal word for an identifier in Firebird, because it is an SQL
keyword, reserved word. ]]

If you don't have a SELECT statement in your tib_query, then the query is
"nothing", undefined.

> 2) What are the Keylinks of the two sets?
> /// keylink for PACIENTE
> /// keylink for PATOLOGIA
> /// masterlink for PATOLOGIA

These would be OK if you actually had anything defined as contents of the

> > 3) Do you open the datasets in your code?
> ( I didn't understand )

The method Open is used to activate the ib_query. Underneath, it causes a
lot of things to happen.

-- First it checks whether the database connection named in the ib_query's
IB_Connection property is connected.

-- If so, it then it checks whether the transaction named in the ib_query's
IB_Transaction property is started. If not, it attempts to start it.

-- Next, it checks whether the SELECT statement in the SQL property is
prepared. If not, it prepares the statement.

-- It does some more checks and, finally, it submits the statement to the

You code needs to open the datasets if they are not active. Somewhere (in
an event related to what you want your application to do) you will need a
block of code similar to this:

with MyQuery do
if not Active then Open;