diablox 发表于 2016-8-30 10:10:39

请教一下一个问题

本帖最后由 diablox 于 2016-9-15 17:09 编辑

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

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

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

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

                      using (DataTable dtSoa = DbHelperSQL.Query(strsql).Tables)
                      {
                               soa201 = new SOA201(dtSoa);
                               soa201.Run(false);
                               sdocument.Pages.Add(soa201.Document);
                     }
                }
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.

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



Lenka.Guo 发表于 2016-8-30 11:02:08

您好,

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

            for (int i = 0; i < sr.Document.Pages.Count; i++)
            {
                sr1.Pages.Add(sr.Document.Pages);
            }

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




diablox 发表于 2016-8-30 14:44:00

好的 我测试一下 感谢

Lenka.Guo 发表于 2016-8-31 10:34:09

diablox 发表于 2016-8-30 14:44
好的 我测试一下 感谢

问题解决了吗?

diablox 发表于 2016-9-15 17:08:13

以上代码已经测试可以正确运行。感谢。

Lenka.Guo 发表于 2016-9-18 09:21:36

diablox 发表于 2016-9-15 17:08
以上代码已经测试可以正确运行。感谢。

好的,谢谢反馈~~
页: [1]
查看完整版本: 请教一下一个问题