如何使用VB.net在Crystal Report中为子报表设置DataSource [英] How to set DataSource for Subreports in Crystal Report Using VB.net

查看:97
本文介绍了如何使用VB.net在Crystal Report中为子报表设置DataSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我正在使用包含一个主报告和一个子报告的水晶报告



每个主记录包含一些基本数据并在子报告中包含组数据。 br />
锄头为上述解决方案设置代码。



例如:公司希望显示所有员工的基本记录以及月度年度每个员工的报告作为子报告



我使用以下代码来制作简单的水晶报告



Problem : I am using a crystal report which contain One main report and one subreport

each main record contain some basic data and have group data in subreport.
Hoe to set codes for above solution.

for Example : a company wants to show basic record for all employees as well as month wise annual report for each employee as subreport

I use following code to a simple crystal report

dim CrReport as New CRmain

crMain.SetDataSource(DTable)

RptViewr1.Reportsource = CrReport

RptViewr1.refresh()

推荐答案

您还需要为子报告设置数据源。在这里,阅读子报告部分:在.Net中使用Crystal Reports [ ^ ]
You need to set up datasource for the sub report too. Here it is, read the "Sub report" section: Working with Crystal Reports in .Net[^]


dim CrReport as New CRmain
 
CrReport.SetDataSource(DTable)
 
RptViewr1.Reportsource = CrReport
 
RptViewr1.refresh()


这种方式...

this way...
   Dim orpt As New ReportDocument
...
   orpt.Subreports("HeaderRpt.rpt").SetDataSource(HeaderDT)

< br $>
快乐编码!

:)


Happy Coding!
:)


这篇关于如何使用VB.net在Crystal Report中为子报表设置DataSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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