SQL Query must work but doesn't

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
werkstattboss
Posts: 20
Joined: Fri 15 May 2009 17:53

SQL Query must work but doesn't

Post by werkstattboss » Wed 22 Jun 2011 14:29

Hi
I use IBDac 3.10.0.16 with Delphi 7.01 (Enterprise) and a Firebird Server (classic) V1.5 on XP SP3, trying to migrate an old Delphi5 Project to IbDac.

I am very sorry to bother you with this, but I can not find a reason why this does not work as expected:

DM.AuxQry.sql.add('select * from auftrag where');

DM.AuxQry.sql.add('kunde = '+inttostr(kunde)+' and ');
DM.AuxQry.sql.add('Rechdatum between ');
DM.AuxQry.sql.add(' '''+von+''' and '''+bis+''' '); // 2 Date Values converted with DateToString
DM.AuxQry.sql.add(' and status between 1000 and 1050');

DM.AuxQry.Open;
count := DM.AuxQry.recordcount; //-- Recordcount is 0
DM.AuxQry.first;
DM.AuxQry.DisableControls;
while not DM.AuxQry.eof do begin // -- Loop is not entered, EOF is true

DM.AuxQry is a TIBCQuery.

The same SQL statement gets me 33.157 Records from the same table on IBExpert.

Anyone any idea?

TIA Rolf

AndreyZ

Post by AndreyZ » Wed 22 Jun 2011 15:22

Hello,

I cannot reproduce the problem. Please try seting the TIBCQuery.Debug property to True. This way you will be able to look at the exact SQL statement that TIBCQuery sends to the server. It should help to find the cause of this problem. Note that you should add the IBDacVcl unit to the USES clause of any unit in your project to make the Debug property work.

Post Reply