🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1527

Re: Blob data

#1527
From: Viatcheslav V. Vassiliev
Date: Wed, 05 May 2004 19:16
52 lines
2407 bytes
Code is not tested but it should look like this:

TFileStream * Blob = new TFileStream(ImageFile, fmOpenRead);
try
{
 ADOQuery1->SQL->Text = "SELECT * FROM ImgQueue";
 ADOQuery1->Open();
 ADOQuery1->Inert();
 ((TBlobField*)ADOQuery1->FieldByName("Image"))->LoadFromStream(Blob);
 ADOQuery1->Post();
 ADOQuery1->Close();
}
__finally
{
 delete Blob;
}

//------------------------------------------
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)

"Scott Elgram" <SElgram@verifpoint.com> �������/�������� � ��������
���������: news:4092e332$1@newsgroups.borland.com...
> Hello,
>     I am in need to stream TIF images into a MS SQL database.  I am using
> BCB6 and am more familiar with ADO then any of the other DB components
> offered.  I know in Delph 7 the code to do this is;
>
> -------------Begin Delphi Code---------------
> Blob := TFileStream.Create(ImageFile, fmOpenRead);
>   With ADOQuery1 do
>       begin
>           SQL.Text := 'SELECT * From ImgQueue';
>           Open;
>           Insert;
>           (FieldByName('Image') AS TBlobField).loadfromStream(Blob);
>           Post;
>           Close;
>       end;
> --------------End Delphi Code--------------
>
> Can anyone tell me how I can accomplished this in C++?
>
> thanks,
> -- 
> -Scott Elgram
>
>
Technical Details
Message-ID: <40993d7a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4092e332$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,ff68206e3ae6c5cb
X-Google-Attributes: gid10698b,public
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <4092e332$1@newsgroups.borland.com>
Subject: Re: Blob data
Date: Wed, 5 May 2004 23:16:11 +0400
Lines: 54
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: <40993d7a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1083784570 213.234.218.42 (5 May 2004 12:16:10 -0700)
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail