你试过了吗?给你贴一段代码,我在一个BLOB字段中存了N个报表,报表类型是未定义的,可能是
FastReport的,也可能是ReportMachine的,也可能是其他报表系统的。
procedure TSysReport.FormShow(Sender: TObject);
var
reps:^Rep;
i:integer;
bm:TClientBlobStream;
begin
inherited;
Reps:=pointer(integer(Fdata[3]));
Connect:=TDispatchConnection(integer(FData[2]));
getvalueMethod:=FData[4];
ParNames:=pointer(integer(Fdata[5]));
ModuleId:=Fdata[6];
rights:=FData[7];
fform:=TForm(integer(FData[8]));
localname:=Fdata[9];
for i:=0 to high(reps^) do
dxPickEdit1.Items.Addobject(Reps^.RepName,TObject(@Reps^));
//读取模块的报表
with SWDataSet1 do
try
RemoteServer:=Connect;
DisableMsg:=true;
open;
if Fields[2].IsNull then
ClientDataSet1.CreateDataSet
else
begin
BM:=TClientBlobStream.Create(TBlobField(Fields[2]),bmread);
bm.Position:=0;
ClientDataSet1.LoadFromStream(BM);
bm.Free;
end;
except
end;
end;
//保存到数据库
procedure TSysReport.DoOK;
var
BM:TClientBlobStream;
begin
ClientDataSet1.CheckBrowseMode;
SWDataSet1.ReadOnly:=false;
SWDataSet1.Edit;
bm:=TClientBlobStream.Create(TBlobField(SWDataSet1.fields[2]),bmwrite);
bm.Position:=0;
ClientDataSet1.SaveToStream(bm);
bm.Free;
SWDataSet1.SaveData;
inherited;
end;
其中SWDataSet1中有一个字段Fields[2]是Blob字段,其中实际保存了一张表,其表结构是:
ClientDataSet1RepName: TStringField;
ClientDataSet1RepType: TStringField;
ClientDataSet1RepVersion: TStringField;
ClientDataSet1MISONo: TStringField;
ClientDataSet1VISONo: TStringField;
ClientDataSet1Remark: TBlobField;
ClientDataSet1Report: TBlobField;
ClientDataSet1RepDef: TBlobField;
OK,明白了?