水晶报表SubReport链接参数错误 [英] Crystal report SubReport Link parameters error

查看:82
本文介绍了水晶报表SubReport链接参数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在水晶报告中,
我创建了一个子报告.
将该子报表与A字段"RecNo"链接
但运行时会显示对话框

1.输入Pm-Table.RecNo
的离散值.
2.此字段名称未知..公式记录选择{Table.RecNo} = {?Pm-Table.RecNo}中的错误.此字段名称未知.

请提出解决此问题的方法,
在此先感谢
:)

In crystal report,
I have create a sub report.
linking that sub report with A field ''RecNo''
but run time it shows Dialog box

1. Enter Discrete value for Pm-Table.RecNo

2. This field name is not known.. error in formula record selection {Table.RecNo}={?Pm-Table.RecNo}. this field name is not known.

please suggest a way for solving this issue,
thanks in advance
:)

推荐答案

问题已解决,希望对遇到相同问题的人有用.

我有2个子报表,使用索引0&从代码中访问它们. 1 [用于分配数据源运行时].子报表的索引被倒置,因此数据源分配出错,这就是为什么在链接参数中找不到"RecNo"的原因,因为在该表中没有这样的字段.

实际上更喜欢使用 name代替索引从代码访问子报表
当您选择子报表并查看其属性[F4]时,会有一个Name属性,它将为您提供子报表的名称.

issue is solved, hope it will useful to them who are suffering with the same problem.

I have 2 sub reports accessing them from code using index 0 & 1 [for assign datasource runtime]. Index of subreports were inverted, so that datasource assignment was going wrong that''s why in link parameter it was unable to find ''RecNo'' because in that table there was not such field.

in practice prefer accessing subreport from code using name instead of index
when you will select subreport and see it''s property[F4] there is a Name property it will give you name of subreport.

Dim orpt As New ReportDocument
Dim a = System.Reflection.Assembly.GetExecutingAssembly.Location
a = a.Substring(0, a.IndexOf("\bin\"))
dt.WriteXmlSchema(a & "\Reports\Receipt.xml")

Dim HeaderDT As DataTable
HeaderDT = DBGetData("select ...")
HeaderDT.WriteXmlSchema(a & "\Reports\HeaderRpt.xml")

orpt.Load(a & "\Reports\Receipt.rpt")
orpt.SetDataSource(dt)
orpt.Database.Tables(0).SetDataSource(dt)
orpt.Subreports("HeaderRpt.rpt").SetDataSource(HeaderDT) 'index 1 accessed using 0 that was mistake
orpt.Subreports("HeaderRpt.rpt").Database.Tables(0).SetDataSource(HeaderDT)
orpt.Subreports("Dtls.rpt").SetDataSource(dt)
orpt.Subreports("Dtls.rpt").Database.Tables(0).SetDataSource(dt)
orpt.Refresh()
CrystalReportViewer1.ReportSource = orpt



祝您编码愉快!
:)



Happy Coding!
:)


这篇关于水晶报表SubReport链接参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆