Error Comes at showing the Crystal Report
-
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.
-
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.
Your message got posted twice, please delete the previous one. You do not indicate which line of your code gets the error so it is difficult to guess why it is going wrong. Please edit your message to show where the error occurs.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
Your message got posted twice, please delete the previous one. You do not indicate which line of your code gets the error so it is difficult to guess why it is going wrong. Please edit your message to show where the error occurs.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
All of my code lines are getting debug successfully without any error. But error has been shown at my page by debugging all of my lines. Thanks in adv.
Balasubramanian K.
modified on Wednesday, February 17, 2010 7:29 AM
-
All of my code lines are getting debug successfully without any error. But error has been shown at my page by debugging all of my lines. Thanks in adv.
Balasubramanian K.
modified on Wednesday, February 17, 2010 7:29 AM
BalasubramanianK wrote:
All of my code lines are getting debug successfully without any error. But error has been shown at my page by debugging all of my lines. Thanks in adv.
Which of these two statements is true?
txtspeak is the realm of 9 year old children, not developers. Christian Graus