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. Web Development
  3. ASP.NET
  4. Object reference not set to an instance of an object.

Object reference not set to an instance of an object.

Scheduled Pinned Locked Moved ASP.NET
helpquestion
5 Posts 3 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.
  • C Offline
    C Offline
    CrazyCoder26
    wrote on last edited by
    #1

    Hi I am developing an webpage.In my webpage there is a textbox.According to the textbox value,some details come on a button click.In button click event I've initialized OracleCommand object.My code is working for two times.But third time when I press the button,an error occurs saying object reference not set to an instance of an object. I have done such codings thousands of time.But this time I am clueless why this is happening.Can any one help me out?

    ARINDAM

    B 1 Reply Last reply
    0
    • C CrazyCoder26

      Hi I am developing an webpage.In my webpage there is a textbox.According to the textbox value,some details come on a button click.In button click event I've initialized OracleCommand object.My code is working for two times.But third time when I press the button,an error occurs saying object reference not set to an instance of an object. I have done such codings thousands of time.But this time I am clueless why this is happening.Can any one help me out?

      ARINDAM

      B Offline
      B Offline
      Bardy85
      wrote on last edited by
      #2

      Are you closing your OracleCommand. Try putting in a break point so you find exactualy one which line your code is breaking.

      C 1 Reply Last reply
      0
      • B Bardy85

        Are you closing your OracleCommand. Try putting in a break point so you find exactualy one which line your code is breaking.

        C Offline
        C Offline
        CrazyCoder26
        wrote on last edited by
        #3

        I have put break point.It is showing the error in string variablename=command.ExecuteScalar().Tostring(). While OracleCommand command=New OracleCommand() line is executing properly before the line at which error occurs. Mysteriously for first two button click it works properly,but at third attempt it gives the error.

        ARINDAM

        L B 2 Replies Last reply
        0
        • C CrazyCoder26

          I have put break point.It is showing the error in string variablename=command.ExecuteScalar().Tostring(). While OracleCommand command=New OracleCommand() line is executing properly before the line at which error occurs. Mysteriously for first two button click it works properly,but at third attempt it gives the error.

          ARINDAM

          L Offline
          L Offline
          Learning IT
          wrote on last edited by
          #4

          can u plz mention that line where error occurs...

          Maniiiiiiiiiiiiiii

          1 Reply Last reply
          0
          • C CrazyCoder26

            I have put break point.It is showing the error in string variablename=command.ExecuteScalar().Tostring(). While OracleCommand command=New OracleCommand() line is executing properly before the line at which error occurs. Mysteriously for first two button click it works properly,but at third attempt it gives the error.

            ARINDAM

            B Offline
            B Offline
            Bardy85
            wrote on last edited by
            #5

            If the query is returning null it could cause this error. Check your query. Also add a try Catch so the program doesn't stop running. Hope this helps.

            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