简体   繁体   English

如何在不询问参数字段的情况下在Asp.Net C#中的Crystal Report中加载子报表

[英]How to load sub report in Crystal Report in Asp.Net C# with out asking Parameter fields

I am developing software in asp.net c#, in that it have a Crystal Reports & also Crystal Reports has a sub report in it.. 我正在asp.net c#中开发软件,因为它具有Crystal Reports,而Crystal Reports也具有子报告。

I load only main report through pass the value of bolReports.Year, 我只通过传递bolReports的值来加载主报告。

The problem is: I can't load sub report using the same parameter.. 问题是:我无法使用相同的参数加载子报表。

When I run the page means it ask parameter to sub reports.. 当我运行该页面时,它会向子报告询问参数。

Anyone help, thanks in advance.. 任何人的帮助,谢谢。

DataSet ds = new DataSet("tbl");
ReportDocument cryRptDoc = new ReportDocument();
string ReportPath = string.Empty;

bolReports.Year = ddlYear.SelectedValue.Trim();

ReportPath = Server.MapPath("~\\Reports\\PerCallBrnMon.rpt");
cryRptDoc.Load(ReportPath);
cryRptDoc.SetDatabaseLogon(bolReports.UserID, bolReports.Password, bolReports.ServerName, bolReports.DataBaseName);
ds = bolReports.sp_CallClosing();
cryRptDoc.SetDataSource(ds.Tables[0]);

CrystalReportViewer1.ReportSource = cryRptDoc;
CrystalReportViewer1.DataBind();

CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
CrystalReportViewer1.HasExportButton = false;
CrystalReportViewer1.HasPrintButton = false;
CrystalReportViewer1.Zoom(80);

Main Report Name : PerCallBrnMon.rpt 主要报告名称: PerCallBrnMon.rpt

Sub Report Name : PerCallBrnMonGrp.rpt 子报表名称: PerCallBrnMonGrp.rpt

Error : 错误:

在此处输入图片说明

Watch this.. 看这个..

在此处输入图片说明

In this code, I have run only main report & main report stored procedure, & I don't know how to run sub report & sub report stored procedure.. the main report has a sub report in it, & both having the same parameter of bolReports.Year .. 在此代码中,我只运行了主报表和主报表存储过程,并且我不知道如何运行子报表和子报表存储过程。主报表中有一个子报表,并且两个参数都相同of bolReports.Year ..

In the template add the links between the main report and the subreport. 在模板中,添加主报表和子报表之间的链接。 It should be available in one of the options in the context menu of the subreport. 它应该在子报表的上下文菜单中的一个选项中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM