Article View: borland.public.cppbuilder.database.ado
Article #5249Re: ADO without ADOExpress
From: Mike
Date: Tue, 26 Jun 2001 14:36
Date: Tue, 26 Jun 2001 14:36
54 lines
2321 bytes
2321 bytes
Thanks for the help Sandor
The program will compile but throws an error after it has compiled. Does the code below look correct or have I gone wrong somewhere.
void __fastcall TForm1::FormCreate(TObject *Sender)
{
_RecordsetPtr pRecSet;
wchar_t *ConnStr=L"D:\Inetpub\wwwroot\BMD\bmdtest.mdb";
pRecSet = CreateComObject(CLSID_Recordset);
pRecSet->Open(L"SELECT * FROM EssxBmd", ConnStr, adOpenStatic, adLockReadOnly, adCmdText);
pRecSet->MoveFirst();
TVariant vVAlue = pRecSet->Fields->get_Item(2)->get_Value();
Memo1 -> Lines -> Add (vVAlue);
pRecSet->Close();
pRecSet->Release();
}
I have declared this in my header
#include <adodb_2k.h>
Thanks
Mike
"Sandor Bognar" <bognars@mail.uti.hu> wrote:
>
>> Thanks for this
>> I have tried but get error messages saying
>> Misuse of typedef fields
>> and
>> undefind symbol iColumnPos.
>
>I'm sorry I made a typo , the correct one is:
>
>TVariant vVAlue = pRecSet->Fields->get_Item(iColumnPos)->get_Value();
>
>And of course you must define the iColumnPos. You can ask the number of
>fileds in the recordset using pRecSet->Fields->Count;
>
>> I allso still can not see how this will display the recordset into a memo.
>
>I'm not sure what you are saying here. vValue contains the value of the
>"Cell" in the Recordset. You can display it wherever you want.
>For example in an editbox : Edit1->Text = vValue;
>
>HTH
>Sandor
>
>
>
>
>
Technical Details
Message-ID:
<3b389df7$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3b179e3c_1@dnews> <3b1de867_1@dnews> <3b371915$1_1@dnews> <3b3838bb_2@dnews> <3b387689$1_2@dnews> <3b388231$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,e13bb3fb20c1e339 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-06-26 07:39:53 PST From: "Mike" <mike@global.co.uk> Sender: "Mike" <mike@global.co.uk> Reply-To: "Mike" <mike@global.co.uk> Subject: Re: ADO without ADOExpress Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 213.121.242.170 213.121.242.170 References: <3b179e3c_1@dnews> <3b1de867_1@dnews> <3b371915$1_1@dnews> <3b3838bb_2@dnews> <3b387689$1_2@dnews> <3b388231$1_1@dnews> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3b389df7$1_1@dnews> Date: 26 Jun 2001 07:36:39 -0700 X-Trace: dnews 993566199 207.105.83.65 (26 Jun 2001 07:36:39 -0700) Lines: 55 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews