Article View: borland.public.cppbuilder.database.ado
Article #1467Re: ADOQuery
From: James Peterson
Date: Thu, 24 Jun 2004 19:51
Date: Thu, 24 Jun 2004 19:51
55 lines
2510 bytes
2510 bytes
try streams.
TStream *Blob
ADOQuery1->CreateBlobStream(ADOQuery1->FieldByName( "theField"), bmWrite);
try {
RichEdit1->Lines->LoadFromStream(Blob);
}
__finally {
delete Blob;
}
This should do a bit read from "thefield" and dump the results to RichEdit1,
Shouldn't matter if is binary or not
"Arnie Mauer" <xxx@nowhere.net> wrote in message
news:40a8f57a$1@newsgroups.borland.com...
> "kev" <kev@isp.com> wrote in message
news:40a8b874@newsgroups.borland.com...
> > Some time ago I posted some questions regarding Blobs. It turns out that
> the
> > field I was trying to access was defined as VarBinary(8000) so I could
not
> > use blob stram (as indicated by V. Vassiliev in an earlier response).
The
> > advise I was given was to use ADOQuery->Fields->Fields[]->Value OR
> > ADOQuery->Recordset->Fields->Item[]->Value.
> >
> > Fields->Value yields a NULL or "". I tried the Recordset, but it does
not
> > seem to be a correct statement. I finally tried
> >
> > char *Buffer.
> > Buffer =(char*) ADOQuery1->Fields->Fields[4];
> >
> > I get something that looks like it might be a pointer, but can't get any
> > further. Can someone please assist me in getting this data from this
> field?
> > It is field [4] and is a byte array with the next field [5] defining the
> > length.
> >
> > thanks,
> > kev
> >
>
> I don't know if this will work for you or not. It works for us, but we're
> reading BLOBs.
>
> AnsiString s = ADOQuery1->FieldByName( "theField" )->AsString;
>
> s.Length() indicates how many bytes were actually read.
>
> HTH,
>
> - Arnie
>
>
Technical Details
Message-ID:
<40db305f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40a8b874@newsgroups.borland.com> <40a8f57a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,5cd61b8b304e7864 X-Google-Attributes: gid10698b,public From: "James Peterson" <jpeterson@romanmealmilling.com> Newsgroups: borland.public.cppbuilder.database.ado References: <40a8b874@newsgroups.borland.com> <40a8f57a$1@newsgroups.borland.com> Subject: Re: ADOQuery Date: Thu, 24 Jun 2004 14:51:33 -0500 Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 64.21.236.129 Message-ID: <40db305f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1088106591 64.21.236.129 (24 Jun 2004 12:49:51 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail