Subject | Re: [IBO] Two or more tables... |
---|---|
Author | Marcelo Machado |
Post date | 2005-12-05T00:19:18Z |
Helen,
in the PACIENTEtib_query i have:
SELECT * ///THE FIELD IS ENDP (Sorry)
FROM PACIENTE
____________________
PLAN (PACIENTE NATURAL)
_______________________
Keylink
PACIENTE.CODIGO
_______________________
in the PATOLOGIAtib_query i have:
SELECT *
FROM PATOLOGIA
FOR UPDATE
_______________________
PLAN (PATOLOGIA INDEX (CODIGO))
_______________________
Keylink
PATOLOGIA.PATOCHAVE
________________________
Masterlink
PATOLOGIA.CODIGO=PACIENTE.CODIGO
__________________________________________
and why the PACIENTE works and PATOLOGIA dont?
Marcelo
Helen Borrie <helebor@...> wrote:
Marcelo,
At 03:16 PM 4/12/2005 -0800, you wrote:
"I´m using a tib_query for each table"
To use tib_query, you must have a SELECT statement in the SQL property, for
example:
select
CODIGO,
NOME,
END, <-------------------- see my note about this
FONE
from PACIENTE
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.
dataset!
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
database.
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
begin
if not Active then Open;
...
end;
Helen
---------------------------------
Yahoo! DSL Something to write home about. Just $16.99/mo. or less
[Non-text portions of this message have been removed]
in the PACIENTEtib_query i have:
SELECT * ///THE FIELD IS ENDP (Sorry)
FROM PACIENTE
____________________
PLAN (PACIENTE NATURAL)
_______________________
Keylink
PACIENTE.CODIGO
_______________________
in the PATOLOGIAtib_query i have:
SELECT *
FROM PATOLOGIA
FOR UPDATE
_______________________
PLAN (PATOLOGIA INDEX (CODIGO))
_______________________
Keylink
PATOLOGIA.PATOCHAVE
________________________
Masterlink
PATOLOGIA.CODIGO=PACIENTE.CODIGO
__________________________________________
and why the PACIENTE works and PATOLOGIA dont?
Marcelo
Helen Borrie <helebor@...> wrote:
Marcelo,
At 03:16 PM 4/12/2005 -0800, you wrote:
>Dear Helen,There is total confusion here. Originally you said
>
>
>Helen Borrie <helebor@...> wrote:
>
>1) What are the two SQL statements?
"I´m using a tib_query for each table"
To use tib_query, you must have a SELECT statement in the SQL property, for
example:
select
CODIGO,
NOME,
END, <-------------------- see my note about this
FONE
from PACIENTE
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?These would be OK if you actually had anything defined as contents of the
> /// keylink for PACIENTE
>
> PACIENTE.CODIGO
>
> /// keylink for PATOLOGIA
>
> PATOLOGIA.PATOCHAVE
>
> /// masterlink for PATOLOGIA
>
> PATOLOGIA.CODIGO=PACIENTE.CODIGO
dataset!
>The method Open is used to activate the ib_query. Underneath, it causes a
> > 3) Do you open the datasets in your code?
>
> ( I didn't understand )
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
database.
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
begin
if not Active then Open;
...
end;
Helen
---------------------------------
Yahoo! DSL Something to write home about. Just $16.99/mo. or less
[Non-text portions of this message have been removed]