Article View: borland.public.cppbuilder.database.ado
Article #1731Re: CreateBlobStream
From: kdl
Date: Tue, 20 Apr 2004 22:30
Date: Tue, 20 Apr 2004 22:30
60 lines
3031 bytes
3031 bytes
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:
<4085a472@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!news-xfer.cox.net!peer01.cox.net!cox.net!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>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,eb986792cae970be X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-04-20 15:39:28 PST From: "kdl" <me@isp.net> 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> Subject: Re: CreateBlobStream Date: Tue, 20 Apr 2004 17:30:17 -0500 Lines: 62 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: 69.68.113.242 Message-ID: <4085a472@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082500210 69.68.113.242 (20 Apr 2004 15:30:10 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!news-xfer.cox.net!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail