Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: subreport Post Reply Post New Topic
Author Message
sramkumarmca
Newbie
Newbie


Joined: 01 May 2011
Online Status: Offline
Posts: 5
Quote sramkumarmca Replybullet 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 IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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 IP Logged
sramkumarmca
Newbie
Newbie


Joined: 01 May 2011
Online Status: Offline
Posts: 5
Quote sramkumarmca Replybullet 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 IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.