Article View: borland.public.cppbuilder.database.ado
Article #2573Retrieving the record count of a filtered ADO dataset
From: Jason Geiger
Date: Wed, 28 May 2003 15:06
Date: Wed, 28 May 2003 15:06
16 lines
2089 bytes
2089 bytes
Our product is switching from a Paradox via BDE application to a SQL-Server (or MSDE) via ADO Express. One major minor problem that we had was with the record count (RecordCount property of the TADODataset) after a filter. I am using Woll2Woll's TwwDBGrid component to view a list of records, select and then drill down into a data entry/modification form. After applying a filter to the dataset the RecordCount property would always show the incorrect number. It would contain the number of total records in the dataset before filtering while the grid showed only those that were allowed through the filter. After having some of my team look into taking the filter and applying it to a where clause and issuing a "SELECT COUNT(*) FROM..." SQL statement we again bumped our heads when we wanted to filter on a lookup or calculated field. The easiest and preliminarily fast solution was to do the following... //Where G is the instance of TwwDBGrid... //Note G may have to have MultiSelect enabled. int ResultCount; G->SelectAll(); ResultCount = G->SelectedList->Count(); G->UnselectAll(); //ResultCount contains the count. I hope this saves a few people some time.
Technical Details
Message-ID:
<3ed4d08f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,78a442a015b8804c,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-05-28 08:10:21 PST From: "Jason Geiger" <jgeiger@udsmr.org> Sender: "Jason Geiger" <jgeiger@udsmr.org> Reply-To: "Jason Geiger" <jgeiger@udsmr.org> Subject: Retrieving the record count of a filtered ADO dataset Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 204.168.139.19 204.168.139.19 NNTP-Posting-Host: 207.105.83.65 Message-ID: <3ed4d08f$1@newsgroups.borland.com> Date: 28 May 2003 08:06:55 -0700 X-Trace: newsgroups.borland.com 1054134415 207.105.83.65 (28 May 2003 08:06:55 -0700) Lines: 19 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail