songxianbin_xxx 发表于 2017-9-13 11:00:12

预览错报。。SQL是能运行的。


SQL能运行,预览报表的时候就出现报错。报错如下。求救 急!!!
错误明细:
GrapeCity.ActiveReports.ReportException: 发生了一个意外错误。更多信息: '索引超出了数组界限。' ---> System.IndexOutOfRangeException: 索引超出了数组界限。
   在 GrapeCity.ActiveReports.Rendering.Data.DataScopeBase.#B4c(Int32 index)
   在 #wxA.#k9V.#ac0(Int32 index)
   在 GrapeCity.ActiveReports.ReportsCore.Rendering.Components.ProgramBase.<>c__DisplayClass7`1.#3v0(IDataScopeInternal scope)
   在 #dIR.#c7V.#U.#mcW.Invoke(IDataScopeInternal scope)
   在 GrapeCity.ActiveReports.Rendering.Components.TextBox.#mhi()
   在 GrapeCity.ActiveReports.Rendering.Components.TextBox.get_ContentValue()
   在 #sxA.#f8V.get_Text()
   在 GrapeCity.ActiveReports.Layout.L2.TxtImpl.<>c__DisplayClassb7`1.#pw0(Int32 vspace)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2a`2.#tdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass30`2.#vdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.GridImpl.<>c__DisplayClass3b`1.#WfX(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass12`2.#kdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2`2.#fdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2a`2.#tdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2`2.#fdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2`2.#fdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2d`2.#udW(Int32 size)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2d`2.#udW(Int32 size)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass73`1.#gnX(Int32 space)
   在 GrapeCity.ActiveReports.Layout.FplImpl.<>c__DisplayClass55`2.#6EZ(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass2`2.#fdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.FplImpl.<>c__DisplayClass3.#ZcX(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L2.CanvasImpl.<>c__DisplayClass79`2.#bw0(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass30`2.#vdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.L.<>c__DisplayClass30`2.#vdW(Int32 space)
   在 GrapeCity.ActiveReports.Layout.LayoutExtensions.#U.#Fw0.MoveNext()
   在 System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
   在 GrapeCity.ActiveReports.Extensions.EnumerableExtensions.<Select>d__13`2.MoveNext()
   在 #sxA.#S2e.#WQA(ITargetDevice targetDevice, IEnumerable`1 pages, LayoutNotificationCallback callback)
   在 GrapeCity.ActiveReports.Layout.LayoutEngine.BuildLayout(LayoutInfo layoutInfo)
   在 #GPr.#RLf.#NNf(IReport report, TargetDeviceCapabilities targetDevice, LayoutNotificationCallback callback)
   在 GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension.Render(IReport report, StreamProvider streams, NameValueCollection settings)
   在 GrapeCity.ActiveReports.Document.PageDocument.Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, Boolean forceDataRefresh, Boolean forceParameterDataRefresh)
   --- 内部异常堆栈跟踪的结尾 ---
   在 GrapeCity.ActiveReports.Document.PageDocument.Render(IRenderingExtension renderingExtension, StreamProvider streams, NameValueCollection settings, Boolean forceDataRefresh, Boolean forceParameterDataRefresh)
   在 GrapeCity.ActiveReports.Viewer.Win.Rdlx.RdlReport.<>c__DisplayClassf.#7yz()
   在 GrapeCity.ActiveReports.Viewer.Win.AsyncLoader.<>c__DisplayClass7.#cAz(Object param0, DoWorkEventArgs param1)
   在 System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   在 System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


KearneyKang 发表于 2017-9-13 11:45:12

您好!
索引超出了数组界限,您的数据源是直接绑定的数据源,还是后台绑定的动态数据源。
这可能是您数据源绑定有问题,需要您一步步去排除
您需要如下操作,进行错误的一步步筛选。
1:首先查询数组中的数据个数是否匹配;

2:查询你所匹配的数组中的数据名称是否存在。

还有就是你说的打印的问题,只打印您显示不了的,这样直接是实现不了。

songxianbin_xxx 发表于 2017-9-13 13:45:34

KearneyKang 发表于 2017-9-13 11:45
您好!
索引超出了数组界限,您的数据源是直接绑定的数据源,还是后台绑定的动态数据源。
这可能是您数据 ...

那打印的问题 要怎么实现?

KearneyKang 发表于 2017-9-13 14:39:51

对应您说的这种打印,我给的建议,您只能新建一个报表页面用表格来显示预览中您没有显示的,然后打印,但是前提是怎么判断哪些是显示了的,哪些是没显示的需要您进行一定的处理(具体怎么处理我这处在你们项目中我也不清楚)
具体操作是您在页面上新增一个按钮,然后在通过按钮的触发来展示没有打印的信息。通过这样应该能实现您的需求

songxianbin_xxx 发表于 2017-9-13 16:11:22

KearneyKang 发表于 2017-9-13 14:39
对应您说的这种打印,我给的建议,您只能新建一个报表页面用表格来显示预览中您没有显示的,然后打印,但是 ...

怎么新增按钮新增哪个按钮??能具体说下怎么操作么。没有显示的内容 怎么显示到时候我看下SQL上能不能实现就好了

songxianbin_xxx 发表于 2017-9-13 17:23:57

KearneyKang 发表于 2017-9-13 14:39
对应您说的这种打印,我给的建议,您只能新建一个报表页面用表格来显示预览中您没有显示的,然后打印,但是 ...


怎么判断显示不下的内容我自己SQL上能解决了。我现在就是用了2页的报表,能不能实现我这个效果,
就是当第二页的表格里有数据的时候就会显示打印出来(这个应该是没问题的),当第二页的表格返回数据为空的时候就不显示不打印,这样能不能做到?

KearneyKang 发表于 2017-9-13 17:49:18

您好!您这通过子报表这样绑定这样是不可以的。因为后台没办法单独获取到您的页二然后进行设置页面可见不可见。
我给的思路是单独重新建一个报表,在报表展示前先进行一个数据源的判断,如果数据不为空就绑定该报表然后显示,如果为空直接跳出不显示。

KearneyKang 发表于 2017-9-13 17:49:21

您好!您这通过子报表这样绑定这样是不可以的。因为后台没办法单独获取到您的页二然后进行设置页面可见不可见。
我给的思路是单独重新建一个报表,在报表展示前先进行一个数据源的判断,如果数据不为空就绑定该报表然后显示,如果为空直接跳出不显示。

songxianbin_xxx 发表于 2017-9-14 10:44:56

KearneyKang 发表于 2017-9-13 17:49
您好!您这通过子报表这样绑定这样是不可以的。因为后台没办法单独获取到您的页二然后进行设置页面可见不可 ...

能不能通过报表里写脚本来实现?如果可以的话脚本应该怎么写?

KearneyKang 发表于 2017-9-14 11:32:42

这个通过脚本写不了
页: [1] 2
查看完整版本: 预览错报。。SQL是能运行的。