Article View: borland.public.cppbuilder.database.ado
Article #1732Re: CreateBlobStream
From: Viatcheslav V. Vassiliev
Date: Thu, 22 Apr 2004 08:10
Date: Thu, 22 Apr 2004 08:10
89 lines
4011 bytes
4011 bytes
Is your field defined as varbinary(8000)? If so, ADO Express will bind it as
TVarBytesField that is not TBlobField.
Try get
ADOQuery->Fields->Field[0]->Value
or even
ADOQuery->Recordset->Fields->Item[0]->Value
and look at its type. If it is not VT_BSTR or array type, you can not use
TADOBlobStream.
//------------------------------------------
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)
"kdl" <me@isp.net> �������/�������� � �������� ���������:
news:4085a472@newsgroups.borland.com...
> Thanks for the response. At first glance,it looks exactly like my line of
> code (stream = new TADOBlobStream....) that generated the original
"Invalid
> Variant Operation" error that prompted the question. I will look at it
more
> closely however... Perhaps I need to check with the Database guys that
> generated the database to make sure the data is valid. I do not know how
> that would cause the error message though.
>
> *** My Original ***
> -------------------------------------------------------------------------
> TADOBlobStream *Stream;
>
> //Crashes on this line. I have tried many variations
> including"CreateBlobStream" and ->Fields[n] with no success.
> Stream = new
>
TADOBlobStream((TBlobField*)adoTraceDetailsDataSet->FieldByName("TraceArray"
> ) ,bmRead);
> --------------------------------------------------------------------------
>
> Thanks again for the input,
> kev
>
>
> <Mike Crapo> wrote in message
> news:va5b805kaktfpiju4sredkjm88tdgcb5ei@4ax.com...
> > Kev.
> >
> > Here is some code on how I get a blob out of a database. It has been
> > changed to make it more generalized, but you should be able to see the
> > meathods.
> >
> > //Connect to database
> > TADOQuery *Query = new TADOQuery(0);
> > TADOBlobStream *Stream;
> > Query->SQL->Add("SELECT TraceDetails FROM TraceTable Where TraceID =
> > 1");
> > Query->Connection = ADOConnection; //Or whatever you ado connection
> > is.
> > Query->CursorType = ctStatic;
> > Query->CacheSize = 10000;
> > Query->CursorLocation = clUseClient;
> > Query->LockType = ltReadOnly;
> > Query->Open();
> > if(Query->RecordCount > 0)
> > {
> > Stream = new
> > TADOBlobStream((TBlobField*)Query->Fields->Fields[0],bmRead);
> > Stream->Position = 0;
> > Stream->SaveToFile("Test.tmp");//Do whatever you want to do with the
> > stream.
> > delete Stream; //Delete Stream before closing conection
> > }
> > delete Query;
> >
> >
> > Mike
> >
> > On Tue, 20 Apr 2004 15:17:35 -0500, "kdl" <me@isp.net> wrote:
> >
> > >TraceDetails
> >
>
>
Technical Details
Message-ID:
<40877de6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4083e397@newsgroups.borland.com> <4084f3da$1@newsgroups.borland.com> <4085340d@newsgroups.borland.com> <40854a43$1@newsgroups.borland.com> <40858559$1@newsgroups.borland.com> <va5b805kaktfpiju4sredkjm88tdgcb5ei@4ax.com> <4085a472@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,eb986792cae970be X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-04-22 01:22:27 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <4083e397@newsgroups.borland.com> <4084f3da$1@newsgroups.borland.com> <4085340d@newsgroups.borland.com> <40854a43$1@newsgroups.borland.com> <40858559$1@newsgroups.borland.com> <va5b805kaktfpiju4sredkjm88tdgcb5ei@4ax.com> <4085a472@newsgroups.borland.com> Subject: Re: CreateBlobStream Date: Thu, 22 Apr 2004 12:10:14 +0400 Lines: 91 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 213.234.218.42 Message-ID: <40877de6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082621414 213.234.218.42 (22 Apr 2004 01:10:14 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail