July 12th, 2012, 03:29 AM
SELECT * FROM CONTASPAG
WHERE ( DT_VENCIMENTO < CAST('2012-07-12' AS DATE) ) AND ( CD_SITUACAO = 1 )
I execute this on IBOConsole and get 9 records as result.
However, when I execute the same querie on a Delphi program, using IBExpress object IBQuerie:
qryContasPag.SQL.Text := "SELECT * FROM CONTASPAG
WHERE ( DT_VENCIMENTO < CAST('2012-07-12' AS DATE) ) AND ( CD_SITUACAO = 1 )" ;
I get only one record, the first of the 9 existent.
What happens? How I can solve this?
Thanks to anyone who can help me
July 12th, 2012, 03:04 PM
There are a couple of questions I would ask about what you posted, and I hope you will not take them the wrong way.
1. I assume, as the query runs, that your actual quotation marks are not as posted.
2. Are you sure you have actually fetched all the records from the server?
I do not use IBExpress myself, so I am not sure whether it only fetches the first record by default.
July 13th, 2012, 02:55 AM
Yes, the problem was the fetching. I add the line:
and everything works fine! (for my purposes)
I do not quite understand the behavior of IBQuery.Open(), sometimes it just fetch a record, sometimes fetchs more ...
FetchAll should be used very carefully because it can generate a very large network traffic, because it transfers all records from server to client at once.
thank you very much for the help.