🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #805

Re: Use of ADO Recordset

#805
From: Bas Groeneveld
Date: Thu, 05 May 2005 00:11
44 lines
2224 bytes
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote in message
news:42789e2f$1@newsgroups.borland.com...
> Use recordset Fields collection, it has operator [] or GetItem() method.

I did manage to get it going using the following

            wstUser =
adoRS->Fields->get_Item(Variant(1))->get_Value().bstrVal;

However I was unable to get the [] operator working. Also the get_Item works
only on the field position, not the name. I expected to be able to go
something like

            wstUser = adoRS->Fields["User"]->Value().bstrVal;

Am I missing something here?

Also I could not access a GetItem method (as suggested in some ADO Recordset
documentation) but had to use get_Item instead.

> ADODataSet has property Recordset that you can use, it takes
> System::DelphiInterface< _Recordset >.

Thanks, I've got that to work.

Could you please tell me if the following code is correct. I especially
wondered if I need to dispose of the Recordset originally created with the
TADODataSet - or does that not exist until the Dataset is actually
populated?

    (Adodb_tlb::Recordset15*)ado = RxWClient->GetEmailAddresses(&ClientID);

    TADODataSet* ds = new TADODataSet(this);

    ds->Recordset = (Adoint::Recordset*)ado;

    ShowMessage(ds->FieldByName("Phone Number")->AsString);

    delete ds;

    ado->Close();

Cheers
Bas
Technical Details
Message-ID: <42796494@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <42787b1f$1@newsgroups.borland.com> <42789e2f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,6b79b4524634c0b2
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bas Groeneveld" <nospam@nospam.com.au>
Newsgroups: borland.public.cppbuilder.database.ado
References: <42787b1f$1@newsgroups.borland.com> <42789e2f$1@newsgroups.borland.com>
Subject: Re: Use of ADO Recordset
Date: Thu, 5 May 2005 10:11:00 +1000
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 139.168.54.81
Message-ID: <42796494@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115251860 139.168.54.81 (4 May 2005 17:11:00 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail