Subject Recordcount Bug?
Author dr_bentonquest
Hi there,

Calling Recordcount after opening the following query causes an error:

SELECT 'FA' as
TIPODOC,A.NUMERO,A.FECHA,B.CANTIDAD,B.UNITARIO,B.IMPORTE
FROM FACTURAS A
JOIN DETALLEFAC B ON (B.NUMERO=A.NUMERO)
WHERE A.CLIENTE=:pClien AND A.FECHA BETWEEN :pDesde AND :pHasta
AND A.CANCELADA='F'
AND B.CVEART=:pArtic
UNION
SELECT 'PE' as
TIPODOC,A.NUMERO,A.FECHA,B.CANTIDAD,B.UNITARIO,B.IMPORTE
FROM PEDIDOS A
JOIN DETALLEPED B ON (B.NUMERO=A.NUMERO)
WHERE A.CLIENTE=:pClien AND A.FECHA BETWEEN :pDesde AND :pHasta
AND A.CANCELADA='F'
AND B.CVEART=:pArtic
ORDER BY 2,1

I open the query this way:

with quDatos do
try
ParamByName('pClien').AsInteger:=quClientesNUMERO.AsInteger;
ParamByName('pDesde').AsDateTime:=pfDesde.AsDateTime;
ParamByName('pHasta').AsDateTime:=pfHasta.AsDateTime;
ParamByName('pArtic').AsString:=pfClave.AsString;
Open;
if RecordCount=0 then // this line causes trouble


Error message is:
SQL error code = -104
invalid command
count of column list and variable list do not match

Error is in TIBOInternal dataset.

Please note that if instead of Recordcount I use the IsEmpty
property, everything's OK.

Thanks for your attention,

-Benton
Using IBO 4.2I for Delphi 7