简体   繁体   中英

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..

I load only main report through pass the value of bolReports.Year,

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

Sub Report Name : 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 ..

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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