水晶报表(带子报表)导出PDF出错

yongjunjx 2010-08-25 09:29:48
做的是网站上下载报表(PDF格式)。后台有个DLL把水晶报表导出PDF后输出。但是最近增加了一个报表是带子报表的,下载的时候就报错。
Logon failed.
Details: crdb_adoplus : Object reference not set to an instance of an object.Error in File C:\XXXXXX\temp_063b9145-b13f-4d55-8902-45af60022f54 {9D4CB1D0-A2BD-47DE-A3F3-C90473D5BDF2}.rpt:
Unable to connect: incorrect log on parameters.
代码如下:
 cr_inspection_MassSine ExportRPT = new cr_inspection_MassSine();
ExportRPT.SetDataSource(ds);
scom.CommandText = " select * from inspection_masssine_detail where reportno='" + QCReportID + "'";
sda.Fill(ds, "inspection_MassSine_detail");
ExportRPT.OpenSubreport("cr_inspection_MassSine_detail").SetDataSource(ds);


ExportOptions creo = new ExportOptions();
DiskFileDestinationOptions crdo = new DiskFileDestinationOptions();

//设置导出选项
creo = ExportRPT.ExportOptions;
creo.ExportFormatType = ExportFormatType.PortableDocFormat;
creo.ExportDestinationType = ExportDestinationType.DiskFile;

//设置磁盘文件选项
crdo.DiskFileName = FileName;
creo.DestinationOptions = crdo;
ExportRPT.Export();

ExportRPT.Close();
ExportRPT.Dispose();

如果没有子报表的,导出正常。
而且同样这段代码,我放在一个C#的form application中运行是可以导出PDF的。
...全文
214 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yongjunjx 2010-08-25
  • 打赏
  • 举报
回复
我的数据源都用的xsd。
同样这些的代码我放到winform里是可以导出PDF的。做DLL放ASP网站就不行。
yongjunjx 2010-08-25
  • 打赏
  • 举报
回复
在父报表中,insert->subreport. 然后create a subreport with report wizard. 然后data选中已经创建的dataset(ds_inspection_MassSine_detail.xsd).
创建好,要编辑子报表的话,是在父报表中双击子报表。在项目中并没有子报表的rpt文件。
阿泰 2010-08-25
  • 打赏
  • 举报
回复
是说你的子报表数据源错:错误的登录参数。

所以同问,你的子报表是直接连得数据库?还是建了一个对应的xsd,里面有一个叫inspection_MassSine_detail的表?
阿双2009 2010-08-25
  • 打赏
  • 举报
回复
你的子报表是通过向导创建的,还是通过rpt创建的?
yongjunjx 2010-08-25
  • 打赏
  • 举报
回复
改了下,
ExportRPT.Subreports[0].SetDataSource(ds.Tables["inspection_MassSine_detail"]);
结果一样。

我不知道incorrect log on parameters这个错,是说数据库错,还是说父报表和子报表之间的参数错?
阿泰 2010-08-25
  • 打赏
  • 举报
回复
sda.Fill(ds, "inspection_MassSine_detail");
ExportRPT.OpenSubreport("cr_inspection_MassSine_detail").SetDataSource(ds);

==>

ExportRPT.SubReports[0].SetDataSource(ds["inspection_MassSine_detail"]);

试试。
yongjunjx 2010-08-25
  • 打赏
  • 举报
回复
子报表不是包括在父报表中的吗?我这里看不到”cr_inspection_MassSine_detail“这个rpt的,只有父报表“cr_inspection_MassSine.rpt”这个文件的。
阿双2009 2010-08-25
  • 打赏
  • 举报
回复
感觉是子报表网络路径没设置好

4,818

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧