Solved

How to get the all records number in DBGrid?

Posted on 2000-03-07
3
189 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
ID: 2597538
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
ID: 2597557
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
ID: 2597823
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Correct Component for Shopping Cart. 2 96
QRReport  TQrmemo vertical stretching 1 42
How to debug For loops? 3 45
Error E2158 compiling with Delphi XE10 Seattle 2 87
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

25 Experts available now in Live!

Get 1:1 Help Now