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. .NET (Core and Framework)
  4. I have serious problem with dataAdapter.Update(..)

I have serious problem with dataAdapter.Update(..)

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpdatabasedebuggingannouncement
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.
  • O Offline
    O Offline
    Oshtri Deka
    wrote on last edited by
    #1

    Sometimes app throws an exception when I try to update one particular table adapter, exception says that it's inner sql adapter is null! That part of code is old at least three years and it work fine until last few days, to make it even stranger when I run through the with debugger it works fine, but when I or testers run it as .exe it crashes again. Same code is used on several places (same data layer) and it crashes only for one controller during insertion. Controller which calls that part of code has two options for saving data, Save and Save and close. Save and close runs into problems, but Save never! Difference is only in form closing. I haven't copied any code because it is simple someAdapter.Update(myRowCollection);. Please help.

    B P 2 Replies Last reply
    0
    • O Oshtri Deka

      Sometimes app throws an exception when I try to update one particular table adapter, exception says that it's inner sql adapter is null! That part of code is old at least three years and it work fine until last few days, to make it even stranger when I run through the with debugger it works fine, but when I or testers run it as .exe it crashes again. Same code is used on several places (same data layer) and it crashes only for one controller during insertion. Controller which calls that part of code has two options for saving data, Save and Save and close. Save and close runs into problems, but Save never! Difference is only in form closing. I haven't copied any code because it is simple someAdapter.Update(myRowCollection);. Please help.

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

      Have you tried to put Try and Catch blocks around your code to see what the exception is?

      O 1 Reply Last reply
      0
      • O Oshtri Deka

        Sometimes app throws an exception when I try to update one particular table adapter, exception says that it's inner sql adapter is null! That part of code is old at least three years and it work fine until last few days, to make it even stranger when I run through the with debugger it works fine, but when I or testers run it as .exe it crashes again. Same code is used on several places (same data layer) and it crashes only for one controller during insertion. Controller which calls that part of code has two options for saving data, Save and Save and close. Save and close runs into problems, but Save never! Difference is only in form closing. I haven't copied any code because it is simple someAdapter.Update(myRowCollection);. Please help.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        What Exception? I had a similar case, in one place in my app I was lazy and used Update and all was fine until I started getting reports of a Concurrency Exception. It turned out that the guy who was generating the data I was working on created some duplicate records; he wasn't supposed to, he said he didn't, and my code couldn't handle it when he did. I changed my code so it doesn't use Update and all is fine. All in all -- don't use DataAdapters!

        O 1 Reply Last reply
        0
        • P PIEBALDconsult

          What Exception? I had a similar case, in one place in my app I was lazy and used Update and all was fine until I started getting reports of a Concurrency Exception. It turned out that the guy who was generating the data I was working on created some duplicate records; he wasn't supposed to, he said he didn't, and my code couldn't handle it when he did. I changed my code so it doesn't use Update and all is fine. All in all -- don't use DataAdapters!

          O Offline
          O Offline
          Oshtri Deka
          wrote on last edited by
          #4

          This is the exception message: "Object reference not set to an instance of an object." It has no inner exception; as I said SqlDataAdapter of TableAdapter component SOMETIMES is null! However it is NEVER null when I run it through debugger, when I remove breakpoints I can expect problems. But everything is initialized and this very code is used for some years without problems.

          1 Reply Last reply
          0
          • B brock2009

            Have you tried to put Try and Catch blocks around your code to see what the exception is?

            O Offline
            O Offline
            Oshtri Deka
            wrote on last edited by
            #5

            Almost entire method is within try-catch block. I've explained exception in other reply.

            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