Article View: borland.public.cppbuilder.database.ado
Article #2535Re: ADODataSet browsing
From: Jerry Bloomfield (TeamB)
Date: Mon, 19 May 2003 20:29
Date: Mon, 19 May 2003 20:29
30 lines
2210 bytes
2210 bytes
On Tue, 20 May 2003 03:01:12 +0800, "booker" <diablohsh@163.net> wrote:
>Dataset->Close();
>Dataset->CommandText="select column1,column2 from tbl_some";
>Dataset->Open();
>
>Dataset->First();
>for(int i=0;i<Dataset->RecordCount;i++)
>{
> ShowMessage(Dataset->FieldByName("column1")->AsString);
> ShowMessage(Dataset->FieldByName("column2")->AsIntegger);
> Dataset->Next();
>}
>
>got that?
But, using RecordCount can be "expensive" if you are dealing with a large
number of rows. It may be more efficient to loop "while ( !Dataset->Eof ).
Using RecordCount will force some database interfaces to retrieve all rows
into local [most likely virtual] storage, and count them. Doing this will
make it much faster to access each row, but it will cause your table open
times to take minutes to hours depending upon the amount of data
involved...
Jerry Bloomfield (TeamB)
--
http://www.teamb.com JersWork@iwc.net
Please do *NOT* send private e-mail without prior permission (my anti-spam
filters will probably just delete it anyway <g>)
Technical Details
Message-ID:
<jdficvs9er21uthamhn31svh1g7jmc0lgb@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ec77698@newsgroups.borland.com> <3ec929f0$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,39ca1f942131ec29 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-05-19 13:32:25 PST From: "Jerry Bloomfield (TeamB)" <JersWork@iwc.net> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: ADODataSet browsing Date: Mon, 19 May 2003 15:29:54 -0500 Organization: LSVFA - Latest Software Version Freaks Anonomous Reply-To: "Jerry Bloomfield (TeamB)" <JersWork@iwc.net> Message-ID: <jdficvs9er21uthamhn31svh1g7jmc0lgb@4ax.com> References: <3ec77698@newsgroups.borland.com> <3ec929f0$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.142.220.8 X-Trace: newsgroups.borland.com 1053376170 216.142.220.8 (19 May 2003 13:29:30 -0700) Lines: 30 X-Authenticated-User: jerswork Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail