Article View: borland.public.cppbuilder.database.ado
Article #806Re: Use of ADO Recordset
From: Viatcheslav V. Vassiliev
Date: Thu, 05 May 2005 06:08
Date: Thu, 05 May 2005 06:08
75 lines
3485 bytes
3485 bytes
In type library Item is property, and GetItem, get_Item and/or [] depends on
program that imports type library. [] are imported, if I am not wrong, by
C++ Builder 6, but not earlier.
> wstUser =
> adoRS->Fields->get_Item(Variant(1))->get_Value().bstrVal;
try
adoRS->Fields->getItem(WideString("User"))->get_Value();
Recordset is disposed when you assign new recordset, you do not need to
dispose it. You need to release your pointer to recordset (ado) - you may do
it just after assigning recordset to TADODataSet, Close() will be called by
TADODataSet.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Bas Groeneveld" <nospam@nospam.com.au> �������/�������� � ��������
���������: news:42796494@newsgroups.borland.com...
> "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:
<4279b874@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42787b1f$1@newsgroups.borland.com> <42789e2f$1@newsgroups.borland.com> <42796494@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,6b79b4524634c0b2 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <42787b1f$1@newsgroups.borland.com> <42789e2f$1@newsgroups.borland.com> <42796494@newsgroups.borland.com> Subject: Re: Use of ADO Recordset Date: Thu, 5 May 2005 10:08:51 +0400 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 85.93.138.132 Message-ID: <4279b874@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1115273332 85.93.138.132 (4 May 2005 23:08:52 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail