Article View: borland.public.cppbuilder.database.ado
Article #4094Re: Setting Page size on an ado command
From: Chris
Date: Thu, 11 Apr 2002 15:07
Date: Thu, 11 Apr 2002 15:07
57 lines
2784 bytes
2784 bytes
Ok, I've got it solved - Borland does not set the connection to the command
object until Execute is called so to set a page size property you need to
set the connection yourself. See code snippet:
// Need to set in order to set Page size
cmd->CommandObject->Set_ActiveConnection(conn->ConnectionObject);
// Need to set page size in order to retrieve more than 1000 records
cmd->Properties->Item[WideString("Page size")]->Value = 64; // Note you
need the cast to WideString
rc->Recordset = cmd->Execute();
"Chris" <Chris.Bucher@sas.com> wrote in message news:3cb45a8f_2@dnews...
> I have Borland C++ Builder 6 and I am am trying to run a query against the
> active directory.
> The problem is that only 1000 records are returned. The solution is to
set
> the Page Size property of the Command object
> to a larger number, say 64. This works in VB.
>
> When I try it in C++ Builder, first it gave me a linker error that
> CheckAutoResult was not found.
> I worked around that problem by adding:
>
> namespace System {
> void __fastcall CheckSafecallResult(HRESULT hr)
> {
> OleCheck(hr);
> }
> }
>
> Now when I set the property the error code says that property is not
> available.
>
> Here is the code:
>
> comm->Properties->Item["Page Size"]->Value = 64; // This line
> gives an error saying that Page Size is not in the collection.
> rc->Recordset = comm->Execute();
>
> while(!rc->Eof){
> ... do something
> rc->Next();
> }
>
> If I take out the Page size setting, the code does work but only retreives
> 1000 rows (an Active Directory thing).
>
> Can someone help me?
>
> Thanks
> Chris
>
>
Technical Details
Message-ID:
<3cb5a6cb$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!gestalt.direcpc.com!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!news-in.spamkiller.net!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3cb45a8f_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,9b33b6ac4ab1211f X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-04-11 08:11:33 PST From: "Chris" <Chris.Bucher@sas.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3cb45a8f_2@dnews> Subject: Re: Setting Page size on an ado command Date: Thu, 11 Apr 2002 11:07:56 -0400 Lines: 59 Organization: SAS X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 149.173.13.76 Message-ID: <3cb5a6cb$1_2@dnews> X-Trace: dnews 1018537675 149.173.13.76 (11 Apr 2002 08:07:55 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!gestalt.direcpc.com!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!propagator-maxim!news-in.spamkiller.net!news02.tsnz.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews