Z zlibo Unregistered / Unconfirmed GUEST, unregistred user! 2008-08-16 #1 要求:报表文件存入数据库中,类型为image,程序从数据库中取出报表文件显示出来,用户可自定义修改,然后再保存到数据库中<br>最好能发个实例
L lngdtommy Unregistered / Unconfirmed GUEST, unregistred user! 2008-08-16 #3 fastreport支持流文件操作<br><br>procedure a;<br>var<br> ms:TMemoryStream;<br>begin<br> fr.savetostream(ms)<br> if ms.Size > 0 then<br> begin<br> ms.posion := 0;<br> //数据库操作保存流<br> //如:TBlobField(adoq.fieldbyname('fr')).loadfromstream(ms);<br> end;<br>end;<br>//反过来读数据库中的报表设置也是一样的.<br>TBlobField(adoq.fieldbyname('fr')).savetostream(ms);<br>fr.loadfromstream(ms);
fastreport支持流文件操作<br><br>procedure a;<br>var<br> ms:TMemoryStream;<br>begin<br> fr.savetostream(ms)<br> if ms.Size > 0 then<br> begin<br> ms.posion := 0;<br> //数据库操作保存流<br> //如:TBlobField(adoq.fieldbyname('fr')).loadfromstream(ms);<br> end;<br>end;<br>//反过来读数据库中的报表设置也是一样的.<br>TBlobField(adoq.fieldbyname('fr')).savetostream(ms);<br>fr.loadfromstream(ms);
大 大器晚成 Unregistered / Unconfirmed GUEST, unregistred user! 2008-08-17 #4 以下代码请参考:<br>procedure Tfrm.btnSaveClick(Sender: TObject);//存入<br>var<br> mstream:TMemoryStream;<br>begin<br> mstream:=TMemoryStream.Create;<br> try<br> mstream.Position:=0;<br> object1.savetostream(mStream); //对象存入流<br> query1.append;<br> TBlobField(qryDoc.FieldByName('content')).LoadFromStream(mstream);<br> query1.Post;<br> showmessage('saved');<br> except<br> end;<br> mstream.Free;<br>end;<br><br>procedure Tfrm.LoadData(); //读取<br>var<br> mstream:TmemoryStream;<br>begin<br> mstream:=TmemoryStream.Create;<br> with query1 do begin<br> sql.Text:=sqltext;<br> try<br> open;<br> mstream.Position:=0;<br> TblobField(FieldbyName('content')).SaveToStream(mstream); //读取流到字段<br> mstream.Position:=0;<br> object1.LoadFromStream(mstream);<br> except<br> end;<br> end;<br> mstream.Free;<br>end;
以下代码请参考:<br>procedure Tfrm.btnSaveClick(Sender: TObject);//存入<br>var<br> mstream:TMemoryStream;<br>begin<br> mstream:=TMemoryStream.Create;<br> try<br> mstream.Position:=0;<br> object1.savetostream(mStream); //对象存入流<br> query1.append;<br> TBlobField(qryDoc.FieldByName('content')).LoadFromStream(mstream);<br> query1.Post;<br> showmessage('saved');<br> except<br> end;<br> mstream.Free;<br>end;<br><br>procedure Tfrm.LoadData(); //读取<br>var<br> mstream:TmemoryStream;<br>begin<br> mstream:=TmemoryStream.Create;<br> with query1 do begin<br> sql.Text:=sqltext;<br> try<br> open;<br> mstream.Position:=0;<br> TblobField(FieldbyName('content')).SaveToStream(mstream); //读取流到字段<br> mstream.Position:=0;<br> object1.LoadFromStream(mstream);<br> except<br> end;<br> end;<br> mstream.Free;<br>end;