Solved

How to get the all records number in DBGrid?

Posted on 2000-03-07
3
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 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