Solved

How to get the all records number in DBGrid?

Posted on 2000-03-07
3
188 Views
Last Modified: 2010-04-04
I want to know how many records in a DBGrid. That DBGrid is using a Qurey. How can I get the number of records?
Yi
0
Comment
Question by:ysimon
3 Comments
 

Accepted Solution

by:
JimboKern69 earned 50 total points
Comment Utility
A DB Grid does not specifically count the number of rows.  Instead, you must use the number of records in the data source for the grid.

If the query is MyQuery, then use:

MyQuery.RecordCount;

A more generic solution can be used if there is a potential for the grid to be tied to varying data sources.  In that case, you can use:

MyDbGrid.DataSource.DataSet.RecordCount;

This will return the number of records in the currently connected data set for the grid.

Jim Kern
0
 

Expert Comment

by:binho
Comment Utility
You can access directly the RecordCount property of your TQuery... It actually returns how many records your dataset (TQuery) has. Since your DBGrid DataSource property is set to the TQuery DataSource, the RecordCount will represent the number of records that are shown in DBGrid.
0
 

Author Comment

by:ysimon
Comment Utility
Thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now