Subject Re: [IBO] Problem with TIB_Query.RecordCount
Author Jörg Buhren
Thomas Steinmaurer schrieb:
> Hello,
>
> I have encountered a problem using TIB_Query.RecordCount
> with a combination of Parametrized TIB_Query, OrderingItemNo <> 0
> and using HDR. I'm using IBO 4.2.Hj
>
> The select statement of the query looks like:
>
> SELECT *
> FROM IBLM$COLUMNLOG
> where logtable_id=:logtable_id
>
> OrderingItems:
>
> ID=ID;ID DESC
> LOGTABLE_ID=LOGTABLE_ID;LOGTABLE_ID DESC
> SPALTE=SPALTE;SPALTE DESC
> ALTERWERT=ALTERWERT;ALTERWERT DESC
> NEUERWERT=NEUERWERT;NEUERWERT DESC
>
> OrderingLinks:
>
> ID=ITEM=1;POS=0
> LOGTABLE_ID=ITEM=2;POS=0
> SPALTE=ITEM=3;POS=0
> ALTERWERT=ITEM=4;POS=0
> NEUERWERT=ITEM=5;POS=0
>
>
> For test purposes I've placed a button on a form with the
> following OnClick event handler.
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> IB_Query1.Close;
> IB_Query1.ParamByName('logtable_id').Value := 1000;
> IB_Query1.Open;
> IB_Query1.OrderingItemNo := 1;
> ShowMessage(IntToStr(IB_Query1.RecordCount)); <---- error with RecordCount
> end;
>
> The following exception is thrown:
>
> ISC ERROR MESSAGE:
> Dynamic SQL Error
> SQL error code = -804
> SQLDA missing or incorrect version, or incorrect number/type of variables
>
>
> The error is only raised when OrderingItemNo is not equal 0
> and when HDR is enabled.
>
>
> The callstack might be useful too:
>
> TIB_SessionBase.HandleException($CB5AA8)
> TIB_Statement.API_ExecImmed2(???,???,$CC0BBC)
> TIB_Statement.SysExecImmed2('SELECT COUNT( * )'#$D#$A'FROM IBLM$COLUMNLOG'#$D#$A'where logtable_id=? /* logtable_id
> */',$CC1120,$CC0BBC)
> TIB_Dataset.SysGetCursorRecordCount
> TIB_BDataset.SysGetCursorRecordCount
> TIB_Dataset.SysRecordCount
> TIB_BDataset.SysRecordCount
> TIB_Dataset.RecordCount
> TForm1.Button1Click(???)
> Project1
>
>
> Any comments/hints? Thank you!
>
>
> Regards,
> Thomas Steinmaurer

Hi Thomas,

I don't know the reason why RecordCount failed, but I have trouble with
these property too.
So I use RowsSelected. The result seems to be the same, but RowsSelected
work.

HTH

Regards
Jörg