| Author |
Message |
sramkumarmca
Newbie
Joined: 01 May 2011
Online Status: Offline
Posts: 5
|

Topic: subreport 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
Edited by sramkumarmca - 03 May 2011 at 9:22pm
|
IP Logged |
|
|
|
BrianBischof
Admin Group
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
|

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>
|
IP Logged |
|
sramkumarmca
Newbie
Joined: 01 May 2011
Online Status: Offline
Posts: 5
|

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;
}
}
|
IP Logged |
|
|
|