Hi All, I am using Asp.Net 2.0 with C#, Crystal Reports(VS 2005). I am trying to open a report by passing 4 parameters but it gives an error called "Object reference not set to an instance of an object.". While I debug, I did not get err at any line. It goes smooth but finally it gives an error. Can you guide me?. Pls find below my code
crvSTT.RefreshReport();
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("Reports/STTCertificateAnnual1.rpt"));
ParameterFields paramFields = new ParameterFields();
ParameterField pfYear = new ParameterField();
ParameterField pfBACode = new ParameterField();
ParameterField pfFromClientCode = new ParameterField();
ParameterField pfToClientCode = new ParameterField();
pfBACode.ParameterFieldName = "pBACode";
ParameterDiscreteValue pdvBACode;
pdvBACode = new ParameterDiscreteValue();
pdvBACode.Value = strUserId;
pfBACode.CurrentValues.Add(pdvBACode);
paramFields.Add(pfBACode);
pfFromClientCode.ParameterFieldName = "pFromClientCode";
ParameterDiscreteValue pdvFromClientCode;
pdvFromClientCode = new ParameterDiscreteValue();
pdvFromClientCode.Value = txtFromCC.Text;
pfFromClientCode.CurrentValues.Add(pdvFromClientCode);
paramFields.Add(pfFromClientCode);
pfToClientCode.ParameterFieldName = "pToClientCode";
ParameterDiscreteValue pdvToClientCode;
pdvToClientCode = new ParameterDiscreteValue();
pdvToClientCode.Value = txtToCC.Text;
pfToClientCode.CurrentValues.Add(pdvToClientCode);
paramFields.Add(pfToClientCode);
pfYear.ParameterFieldName = "pYear";
ParameterDiscreteValue pdvYear;
pdvYear = new ParameterDiscreteValue();
pdvYear.Value = "Current";
pfYear.CurrentValues.Add(pdvYear);
paramFields.Add(pfYear);
crvSTT.ParameterFieldInfo = paramFields;
crvSTT.ReportSource = rp.tDoc;
crvSTT.DataBind();
Thanks in Adv.
Balasubramanian K.