subreport
Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13105
Printed Date: 04 May 2025 at 8:21am
Topic: subreport
Posted By: sramkumarmca
Subject: subreport
Date Posted: 03 May 2011 at 9:22pm
Hi
Below is my code to pass parameter to subreport.However I am getting error"index outside the bounds of the array"
string subreport = @"SubReportFinal.rpt";
crReportDocument.SetParameterValue("@month",49, subreport );
Please help me with this ..veery urgent
|
Replies:
Posted By: BrianBischof
Date Posted: 04 May 2011 at 7:19am
don't use the '@' when referencing the parameter name. That is only done within a Crystal Reports formula, not C# code.
------------- Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
|
Posted By: sramkumarmca
Date Posted: 04 May 2011 at 4:57pm
Still getting same issue..
this is my code..
public partial class Finaltest : System.Web.UI.Page
{
private ReportDocument crReportDocument;
private Database crDatabase;
private Tables crTables;
private CrystalDecisions.CrystalReports.Engine.Table crTable;
private TableLogOnInfo crTableLogOnInfo;
private ConnectionInfo crConnectionInfo = new ConnectionInfo();
protected string sPDFReportFile = "";
protected void Page_Load(object sender, EventArgs e)
{
string sReportFile = Request.PhysicalApplicationPath + @"Crystal Report\FinalMain.rpt";
CrystalDecisions.Shared.ParameterValues pv = null;
CrystalDecisions.Shared.ParameterDiscreteValue pdv = null;
crReportDocument = new ReportDocument();
crReportDocument.Load(sReportFile);
//sub report
// string SubReportFile = Request.PhysicalApplicationPath + @"Crystal Report\SubReportFinal.rpt";
//crReportDocument.OpenSubreport(SubReportFile);
string subreport = @"SubReportFinal.rpt";
crReportDocument.SetParameterValue("month", 49, subreport);
crReportDocument.SetParameterValue("year", 2011, subreport);
crReportDocument.SetParameterValue("compid", 10, subreport);
crReportDocument.SetParameterValue("empcode", 160, subreport);
CrystalReportViewer1.ReportSource = crReportDocument;
}
}
|
|