Board index » delphi » tQuery to TIBQuery doesn't work anymore.

tQuery to TIBQuery doesn't work anymore.

I have this query to fill a tDbGrid:
SELECT DISTINCT FLIGHT.FLIGHT_ID, FLIGHT.FLIGHT_CODE, AIRPORT1.NAME,
AIRPORT2.NAME, FLIGHT.START_TIME, FLIGHT.END_TIME, FLIGHT.LUGGAGES_WEIGHT,
FLIGHT.CASH
FROM FLIGHT
   INNER JOIN AIRPORT AIRPORT1
   ON  (FLIGHT.START_AIRPORT = AIRPORT1.AIRPORT_ID)
   INNER JOIN AIRPORT AIRPORT2
   ON  (FLIGHT.END_AIRPORT = AIRPORT2.AIRPORT_ID)
ORDER BY FLIGHT.START_TIME

Before, I were using a TQuery coupled to a tDataSource in order to fill the
TDbGrid, and it worked fine.

Now, I'm using a TIBQuery. Since I did change, there is no airport2.name on
my grid anymore.

Why ???

Bob

 

Re:tQuery to TIBQuery doesn't work anymore.


Quote

> Now, I'm using a TIBQuery. Since I did change, there is no airport2.name
on
> my grid anymore.

> Why ???

It may be displayed as name_1.  The table name is not a part of the
fieldname with IBX.  Just add an alias to your field in the query.

--
Frederic Gelinas
Programmeur-Analyste
Si Informatique
www.si.qc.ca

Re:tQuery to TIBQuery doesn't work anymore.


IBX just uses the naming convention that IB returns for field names.  You need
to alias the column names when they have the same field name if you want to
display multiple columns with the same field name without IB name mangling.

Quote
Bob Bedford wrote:

> I have this query to fill a tDbGrid:
> SELECT DISTINCT FLIGHT.FLIGHT_ID, FLIGHT.FLIGHT_CODE, AIRPORT1.NAME,
> AIRPORT2.NAME, FLIGHT.START_TIME, FLIGHT.END_TIME, FLIGHT.LUGGAGES_WEIGHT,
> FLIGHT.CASH
> FROM FLIGHT
>    INNER JOIN AIRPORT AIRPORT1
>    ON  (FLIGHT.START_AIRPORT = AIRPORT1.AIRPORT_ID)
>    INNER JOIN AIRPORT AIRPORT2
>    ON  (FLIGHT.END_AIRPORT = AIRPORT2.AIRPORT_ID)
> ORDER BY FLIGHT.START_TIME

> Before, I were using a TQuery coupled to a tDataSource in order to fill the
> TDbGrid, and it worked fine.

> Now, I'm using a TIBQuery. Since I did change, there is no airport2.name on
> my grid anymore.

> Why ???

> Bob

--
Jeff Overcash (TeamB)   I don't think there are any Russians
(Please do not email    And there ain't no Yanks
 me directly unless     Just corporate criminals
 asked.  Thank You)     Playing with tanks.  (Michael Been)

Other Threads