reportmachine 报表从数据库导入导出的问题?
报表从数据库导入导出的问题?
priviewForm:=TpriviewForm.Create (nil) ;
priviewForm.tablename:='报表打印信息表';
priviewForm.field:='合同号';
priviewForm.key:=Cxtextedit1.Text;
//判断此预览信息是否存在
DM_SYSTEM.PRINTADOQuery.close;
DM_SYSTEM.PRINTADOQuery.sql.clear;
DM_SYSTEM.PRINTADOQuery.SQL.Add ('select * from 报表打印信息表 where 合同号=''' + Cxtextedit1.Text + '''') ;
DM_SYSTEM.PRINTADOQuery.open;
if DM_SYSTEM.PRINTADOQuery.RecordCount<>0 then
begin
if application.MessageBox ('此预览信息已存在,是否重新生成?','提示',mb_yesno+mb_iconquestion+MB_DEFBUTTON2) <>idyes then
begin
str:=Tmemorystream.Create;
Tblobfield (DM_SYSTEM.PRINTADOQuery.FieldByName ('合同内容') ) .SaveToStream (str) ;
str.Position:=0;
priviewForm.RMReport1.Preview:=priviewForm.rmPreview1;
priviewForm.RMDBDataSet1.DataSet:=Frm_PoC.po;
priviewForm.RMDBDataSet2.DataSet:=Frm_PoC.po_head;
priviewForm.RMReport1.LoadFromStream (str) ;
priviewForm.RMReport1.ShowPreparedReport;
priviewForm.showmodal;
priviewForm.FREE;
str.free;
exit;
end;
上面的语句运行时报错:不支持的报表格式,我的SQL server 2000数据库 表的字段是:合同号 varchar 20
合同内容 image 类型的
如果把合同内容字段改成 binary类型,存入的时候又报错:invalid class typecast
我该怎么办?