Re: How to insert/download files using BLOB field.



AdoQuery.Append ;
TBlobField(AdoQuery.FieldByName('MyBlob')).LoadFromFile('SomeFile');
AdoQuery.Post ;

You don't need any special SQL statement to get the file data. A simple select
statement that includes the blob will do. Then...

AdoQuery.SQL.Text :=
'Select MyBlob From MyTable Where <SomeCondition>';

AdoQuery.Open ;

TBlobField(AdoQuery.FieldByName('MyBlob')).SaveToFile('SomeFile');

Or

Var
AStrm : TMemoryStream ;

AStrm := TMemoryStream.Create ;
TBlobField(AdoQuery.FieldByName('MyBlob')).SaveToStream(AStrm);
AStrm.SaveToFile('SomeFile');
AStrm.Free ;

-Steve-

"IN" <inasakim@xxxxxxxxxx> wrote in message
news:45199c3d@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

How to insert a file into a BLOB field and how to download it using ADO and
SQL clause.
I use Delphi 6 Pro.

TIA & best regards

I. Nemlich



.



Relevant Pages

  • Re: How to insert/download files using BLOB field.
    ... Nemlich ... You don't need any special SQL statement to get the file data. ... How to insert a file into a BLOB field and how to download it using ADO ...
    (borland.public.delphi.database.ado)
  • Passing BLOB to exe
    ... I am storing file data in a BLOB and would like to pass it to the ... I want the exe that I pass the file data to ...
    (microsoft.public.dotnet.languages.csharp)