示例:
将BMPFile图形文件的内容载入Table1的XXX的BLOB字段。
var
FileStream: TFileStream;
BLOBStream: TBLOBStream;
BMPFile: string;
begin
BMPFile := 'c:/ok.bmp';
if FileExists(BMPFile) then
begin
Table1.Edit;
try
FileStream := TFileStream.Create(BMPFile, fmOpenRead);
try
BLOBStream := TBLOBStream.Create
(TBLOBField(Table1.FieldByName('XXX')),bmReadWrite);
BLOBStream.CopyFrom(FileStream, FileStream.Size);
finally
BLOBStream.Free;
end;
Table1.Post;
finally
FileStream.Free;
end;
end;
end;