Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error Comes at showing the Crystal Report

Error Comes at showing the Crystal Report

Scheduled Pinned Locked Moved C#
csharpasp-netvisual-studiosysadmindebugging
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BalasubramanianK
    wrote on last edited by
    #1

    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.

    L 1 Reply Last reply
    0
    • B BalasubramanianK

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • L Lost User

        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

        B Offline
        B Offline
        BalasubramanianK
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • B BalasubramanianK

          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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups