子报表

IMBIRDMAN 2004-12-27 10:24:14
在vb.net中如何从程序中传条件查询给水晶报表子报表?
...全文
106 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
SeeSunSet 2005-01-05
  • 打赏
  • 举报
回复
这里BS下的:
执行到这句crReportDocument1 = crReportDocument.OpenSubreport("Subreport1")
这里应该传入报表的文件名"report1.rpt"啊.而不是子报表对象的名称.

这里是CS下的:
'显示子报表
Function showSubReport(ByVal mainReport As ReportClass, ByVal Ds As DataSet, ByVal TableName As String, ByVal SubReportControlName As String)
'Dim SubReport As New ReportDocument()
'SubReport = mainReport.OpenSubreport(SubReportName)
Ds.Tables(0).TableName = TableName
'SubReport.SetDataSource(Ds)
'SubReport.Refresh()
Dim subreportName As String
Dim subreportObject As SubreportObject
Dim subreport As New ReportDocument()
If TypeOf (mainReport.ReportDefinition.ReportObjects.Item(SubReportControlName)) Is SubreportObject Then
subreportObject = mainReport.ReportDefinition.ReportObjects.Item(SubReportControlName)
' 获取子报表名称。
SubReportName = SubreportObject.SubreportName
' 打开子报表作为 ReportDocument。
subreport = SubreportObject.OpenSubreport(SubReportName)
' 预览子报表。
subreport.SetDataSource(Ds)
subreport.Refresh()
End If
End Function

这里传的是子报表对象的名称
BS跟CS是不同的.
cansum396 2005-01-05
  • 打赏
  • 举报
回复
你把所有的代码都贴出来看
IMBIRDMAN 2004-12-30
  • 打赏
  • 举报
回复
up
IMBIRDMAN 2004-12-30
  • 打赏
  • 举报
回复
up
IMBIRDMAN 2004-12-30
  • 打赏
  • 举报
回复
执行到这句crReportDocument1 = crReportDocument.OpenSubreport("Subreport1")异常:load report failed。
SeeSunSet 2004-12-28
  • 打赏
  • 举报
回复
'显示子报表
Function showSubReport(ByVal mainReport As ReportClass, ByVal StorePName As String, ByVal PN() As String, ByVal PV() As String, ByVal TableName As String, ByVal SubReportName As String)
Dim SubReport As New ReportDocument()
SubReport = mainReport.OpenSubreport(SubReportName)
Dim Ds As New DataSet() : Dim Ca As New ClassData()
Ds = Ca.DS(StorePName, PV, PN)
Ds.Tables(0).TableName = TableName
SubReport.SetDataSource(Ds)
SubReport.Refresh()
End Function
IMBIRDMAN 2004-12-28
  • 打赏
  • 举报
回复
up
IMBIRDMAN 2004-12-28
  • 打赏
  • 举报
回复
up
beyondjay 2004-12-27
  • 打赏
  • 举报
回复

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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