Solved

How to get the all records number in DBGrid?

Posted on 2000-03-07
3
194 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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