#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Exclamation Discrepant results


    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 )" ;
    qryContasPag.Open() ;

    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    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.
    Correct?

    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.


    Clive
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Exclamation


    Hello clive

    Yes, the problem was the fetching. I add the line:

    qryContasPag.FetchAll() ;

    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.
    Gazoli

IMN logo majestic logo threadwatch logo seochat tools logo