Saving the contents of Blob Fields

Hi There,

I am working on a Delphi application that will incorporate images in its reports.

The images are currently stored in Blob fields (in .pcx format) in a
Foxpro database (using ODBC to access them).  

One of the solutions that I thought of was to save the files in a directory
so that Report Smith can use them.

I ran into a lot of problems when I tried to save the contents of the Blobs to
files.  Since I didn't know the original contents of the Blobs, I switched to
a known entity.  I am now trying to save the contents of the graphic field
in the biolife table that ships with Delphi.

I have tried three methods; all of which I think should work, but give
consistently wrong results.

The methods are as follows.

Assuming that the blob is located in a field call graphic in a
Dataset call Table.

Method 1

TBlobField(Table.FindField('graphic)).SaveToFile('FileName.bmp'));

Method 2

var
OutputFile:TFileStream;
begin
OutputFile := TFileStream.Create('FileName.bmp',fmCreate);
TBlobField(Table.FindField('graphic')).SaveToStream(OutputFile);
OutputFile.Free;

Method 3

var
OutputFile:TFileStream;
BlobStream:TBlobStream;
begin
BlobStream := TBlobStream.Create(TBlobField(Table.FindField('graphic')),bmRead);
OutputFile := TFileStream.Create('FileName.bmp',fmCreate);
OutputFile.CopyFrom(BlobStream,BlobStream.Size);
OutputFile.Free;
BlobStream.Free;

One of the things that I noticed is that in all cases I am type casting
a TField to a TBlobField.  Could this cause the problem.  

I have looked at lots of archives and examples, but people don't seem
to be discussing the contents of Blobs to much.

If you have any suggestions I would really appreciate it.

Thanks,

David.