Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get the all records number in DBGrid?

Posted on 2000-03-07
3
Medium Priority
?
198 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 200 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

636 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