找回密码
 立即注册

QQ登录

只需一步,快速开始

diablox

注册会员

12

主题

39

帖子

123

积分

注册会员

积分
123

活字格认证微信认证勋章

diablox
注册会员   /  发表于:2016-8-30 10:10  /   查看:4058  /  回复:5
本帖最后由 diablox 于 2016-9-15 17:09 编辑

原先的AR6的时候
reportview有 reportview.document.Page.Add  的方法

升级到 AR10时候
reportview有 reportview.document 没有了

然后使用了以下的代码
       SOA201 是报表的名称。
  1. SOA201 soa201;
  2.                 SectionDocument sdocument=new SectionDocument();

  3.                 foreach (string str in lstCusCode)
  4.                 {
  5.                       strsql = " select * from table where 1=1 and cCusCode='xxxxx' order by ccuscode,ddate ";

  6.                       using (DataTable dtSoa = DbHelperSQL.Query(strsql).Tables[0])
  7.                       {
  8.                                soa201 = new SOA201(dtSoa);
  9.                                soa201.Run(false);
  10.                                sdocument.Pages.Add(soa201.Document);
  11.                        }
  12.                 }
  13. viewerReport.LoadDocument(sdocument);
复制代码

      执行代码的时候出现以下错误提示。
      The sections collection is invalid. Please make sure that each Report/Page and Group Header has an associated Footer in the collection and that you have a detail section.

      不知道是何处出了问题,该报表主要是分客户进行数据批打,不知道哪里出错,还请指教。



5 个回复

倒序浏览
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-8-30 11:02:08
沙发
您好,

代码部分, sdocument.Pages.Add(soa201.Document); 这句可能无法通过;
建议修改为:
  1. SectionReport1 sr = new SectionReport1();
  2.             sr.Run(false);
  3.             SectionDocument sr1 = new SectionDocument();

  4.             for (int i = 0; i < sr.Document.Pages.Count; i++)
  5.             {
  6.                 sr1.Pages.Add(sr.Document.Pages[i]);
  7.             }

  8.                 this.viewer1.LoadDocument(sr1);
  9.         }
复制代码
另外: 错误提示说区域报表中的页眉与页脚,或组头与组尾的数量不匹配,是否将报表中的这些结构删除了,导致结构不稳定?




回复 使用道具 举报
diablox
注册会员   /  发表于:2016-8-30 14:44:00
板凳
好的 我测试一下 感谢
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-8-31 10:34:09
地板
diablox 发表于 2016-8-30 14:44
好的 我测试一下 感谢

问题解决了吗?

评分

参与人数 1满意度 +5 收起 理由
diablox + 5 很给力!

查看全部评分

回复 使用道具 举报
diablox
注册会员   /  发表于:2016-9-15 17:08:13
5#
以上代码已经测试可以正确运行。感谢。
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-9-18 09:21:36
6#
diablox 发表于 2016-9-15 17:08
以上代码已经测试可以正确运行。感谢。

好的,谢谢反馈~~
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部