Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am getting Error as follows. any one can tell me why i am getting this error i am new in crystal reports.
C#
System.NullReferenceException was caught
Message=Object reference not set to an instance of an object.
Source=StaticData
StackTrace:
     at StaticData.View.AbstractFormUpdate.GetReport(Int32 rptID) in F:\25Dec2011\CMSWorldApp-5-7-2011\StaticData\View\AbstractFormUpdate.cs:line 505
InnerException:

I want to pass parameter at run time to crystal report i have wrote this code for that
CODE:
C#
ParameterFieldDefinitions varParameterFieldDefinitions;
            ParameterFieldDefinition varParameterFieldDefinition;
            ParameterValues varParameterValues=null;
            ParameterDiscreteValue varParameterDiscreteValue = new    ParameterDiscreteValue();
            try
            {
                dr = GetParameterAndValue(rptID);
                Temp = GetRptTempName(rptID);// geting path of Report Template
                varParameter=dr["ParameterName"].ToString();
                varParameterValue = dr["ParamValue"].ToString();


                if (System.IO.File.Exists(Temp))
                {
                    O_Report.Load(Temp);
                    O_Report.SetDatabaseLogon(userid, password, serverName, databaseName);
                }
                else
                    DXMessageBox.Show("The source file does not exist.");

                varParameterDiscreteValue.Value = varParameterValue;
                varParameterFieldDefinitions = O_Report.DataDefinition.ParameterFields;
                varParameterFieldDefinition=varParameterFieldDefinitions[varParameter];

               // varParameterValues.Clear();
                varParameterValues.Add(varParameterDiscreteValue);
              varParameterFieldDefinition.ApplyCurrentValues(varParameterValues);

                RptViewer.ReportSource = O_Report;


Thanks in advanced.
Posted
Updated 26-Dec-11 19:42pm
v3

with uses of groupsection fromula and recordsectionformula
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900