Board index » delphi » Help! RecordCount Method returns error

Help! RecordCount Method returns error

Hi

Am using Delphi 3.0 C/S.

I have a generic routine to do processing.  It loops through several
tables, checking to see if processing needs to be done.  For some
tables, it stops and gives an error when checking the RecordCount.  It
works perfectly fine for other tables.

A snippet of the code is:

      SQL.Clear;
      SQLCommand := 'Select * From ' + TableName +
                    ' WHERE ReplicateStatus = ''IVR'' ';
      SQL.Add(SQLCommand);
      Open;
      dmDataReplicate.quSourceRSVP.First;
    end;

    if dmDataReplicate.dsSourceRSVP.DataSet.RecordCount > 0 then
     begin

All query action occures through one Tquery and  one TDataSource
component.

Why would it work fine for most tables, but fail for others?

Any thoughts

Darryl Kimak
dar...@inorbit.com

 

Re:Help! RecordCount Method returns error


Quote
Darryl Kimak wrote:

>     if dmDataReplicate.dsSourceRSVP.DataSet.RecordCount > 0 then
>      begin
> Why would it work fine for most tables, but fail for others?
> If you ask for the recordcount of an empty table you would expect to get

zero. The query though returns an *empty* table! So the Recordcount
property cannot be determined. Put the If in a Try..,Except.

Hope this helps.

Other Threads