RecordCount on a TQuery 
Author Message
 RecordCount on a TQuery

I hope someone can help me with this...

I have a TDataSource connected to a TQuery, and when I execute the
following code:

i:= (DataSource1.Dataset as TQuery).RecordCount;

...I get the message:  Table does not support this operation.

The query is getting data from Oracle tables, and includes a memo
field from one particular table - when I take the memo field out of
the query, the code works fine.  Why is this?

Thanks in advance.



Sat, 24 Mar 2001 03:00:00 GMT  
 RecordCount on a TQuery

Quote:

>I hope someone can help me with this...

>I have a TDataSource connected to a TQuery, and when I execute the
>following code:

>i:= (DataSource1.Dataset as TQuery).RecordCount;

>...I get the message:  Table does not support this operation.

Silly question,perhaps, but why don't you just use
<myquery>.recordcount without involving the dataset?

St?le Sannerud



Sat, 24 Mar 2001 03:00:00 GMT  
 RecordCount on a TQuery
I'm not sure record count works with Oracle tables, Some tables only
return -1.  Might want to check documentation.


Sat, 24 Mar 2001 03:00:00 GMT  
 RecordCount on a TQuery


Quote:
>I'm not sure record count works with Oracle tables, Some tables only
>return -1.  Might want to check documentation.

The record count works fine if I take the memo field out of the SQL
statement, so is this some sort of limitation?

Thanks,

Steven H.



Sun, 25 Mar 2001 03:00:00 GMT  
 RecordCount on a TQuery
Sorry I've never used the record count in SQL  I always run the query then
assign record count to a variable.
var1 := query1.recordcount.  This works great with paradox binary fields and
memo fields.
Quote:



>>I'm not sure record count works with Oracle tables, Some tables only
>>return -1.  Might want to check documentation.

>The record count works fine if I take the memo field out of the SQL
>statement, so is this some sort of limitation?

>Thanks,

>Steven H.



Sun, 25 Mar 2001 03:00:00 GMT  
 RecordCount on a TQuery

Quote:

>I have a TDataSource connected to a TQuery, and when I execute the
>following code:
>i:= (DataSource1.Dataset as TQuery).RecordCount;
>...I get the message:  Table does not support this operation.
>The query is getting data from Oracle tables, and includes a memo
>field from one particular table - when I take the memo field out of
>the query, the code works fine.  Why is this?

I can't really tell you *why* it happens, but I'd suggest you don't
ever use RecordCount on a TQuery connected to an Oracle table anyway,
because it causes the query to fetch *ALL* resulting rows from the
Oracle table, not a very good behaviour at all!

Instead, use a SELECT COUNT(*) query with the same WHERE clauses and
execute it to retrieve the number of records the query will return.
Much better practice in a SQL / C/S environment! Saves a lot of time
and unnecessary network traffic....

Marc

--------------------------------------------------------------------------
Marc Scheuner                            Berner Versicherungen, Dept. ISV
May the Source be With You               Laupenstrasse 27

--------------------------------------------------------------------------



Mon, 26 Mar 2001 03:00:00 GMT  
 RecordCount on a TQuery

Quote:

>Instead, use a SELECT COUNT(*) query with the same WHERE clauses and
>execute it to retrieve the number of records the query will return.
>Much better practice in a SQL / C/S environment! Saves a lot of time
>and unnecessary network traffic....

Thankyou!

Steven H.



Mon, 26 Mar 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. TQuery returning improper recordcount

2. TQuery RecordCount property

3. : TQuery RecNo & RecordCount

4. "TQuery".RecordCount with memofields

5. TQuery - RecordCount problem

6. RecordCount of TQuery

7. TQuery type dataset RecordCount wrong?

8. RecordCount or RowsAffected on a TQuery don't work

9. RecordCount Method for TTable and TQuery

10. TQuery RecordCount Problem.

11. TQuery.RecordCount

12. SQL Server + TQuery + RecordCount + Field: Text => BUG !!

 

 
Powered by phpBB® Forum Software