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. OleDbData Adapter.Update Command Error

OleDbData Adapter.Update Command Error

Scheduled Pinned Locked Moved C#
databasehelpquestionannouncement
8 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.
  • Y Offline
    Y Offline
    yesufollower
    wrote on last edited by
    #1

    I've been trying to use the Update method of the OleDbDataAdapter to update a MS Access database, but have not had success. I'm updating a DataTable object through several data bound controls and want to update the database using the values in those bound controls by simply clicking a 'Save' button. The Update OleDbDataAdapter method seemed the most appropriate method to use, but it hasn't worked. I don't get an explicit error, but no changes are made to the source database. Would anyone be able to suggest a reason for this? Thanks.

    B 1 Reply Last reply
    0
    • Y yesufollower

      I've been trying to use the Update method of the OleDbDataAdapter to update a MS Access database, but have not had success. I'm updating a DataTable object through several data bound controls and want to update the database using the values in those bound controls by simply clicking a 'Save' button. The Update OleDbDataAdapter method seemed the most appropriate method to use, but it hasn't worked. I don't get an explicit error, but no changes are made to the source database. Would anyone be able to suggest a reason for this? Thanks.

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

      I assume that you assigned a command object to the UpdateCommand property of the DataAdapter. If you have done that, then please check if you have access to update the table.

      Y 1 Reply Last reply
      0
      • B ben2

        I assume that you assigned a command object to the UpdateCommand property of the DataAdapter. If you have done that, then please check if you have access to update the table.

        Y Offline
        Y Offline
        yesufollower
        wrote on last edited by
        #3

        How would I check if I have access?

        B 1 Reply Last reply
        0
        • Y yesufollower

          How would I check if I have access?

          B Offline
          B Offline
          ben2
          wrote on last edited by
          #4

          If it's a windows application just try a simple update query and see if you can update it If it's a web application, try to give ASPNET account proper privileges

          Y 1 Reply Last reply
          0
          • B ben2

            If it's a windows application just try a simple update query and see if you can update it If it's a web application, try to give ASPNET account proper privileges

            Y Offline
            Y Offline
            yesufollower
            wrote on last edited by
            #5

            Thanks. Actually, that was not the problem. Basically, I wanted to use a DataGridView to display changes to the underlying data source, while using the data bound text box controls for editing purposes. Unfortunately, the way I set it up, the data table was not getting changed by changing the text box values. Still, I have encountered another problem, and that is a concurrency violation. What could be the source of the concurrency violation?

            B 1 Reply Last reply
            0
            • Y yesufollower

              Thanks. Actually, that was not the problem. Basically, I wanted to use a DataGridView to display changes to the underlying data source, while using the data bound text box controls for editing purposes. Unfortunately, the way I set it up, the data table was not getting changed by changing the text box values. Still, I have encountered another problem, and that is a concurrency violation. What could be the source of the concurrency violation?

              B Offline
              B Offline
              ben2
              wrote on last edited by
              #6

              concurreny problem occurs when more than 1 users are trying to update the same record, it might happen that one will end up changing a record that has already been modified by other users. To fix concurrency violation, in your update query check if the record that you had read (and you're about to modify) has been modified or not. If it has been modified, don't update. Otherwise update it. This is called optimistic concurrency control.

              Y 1 Reply Last reply
              0
              • B ben2

                concurreny problem occurs when more than 1 users are trying to update the same record, it might happen that one will end up changing a record that has already been modified by other users. To fix concurrency violation, in your update query check if the record that you had read (and you're about to modify) has been modified or not. If it has been modified, don't update. Otherwise update it. This is called optimistic concurrency control.

                Y Offline
                Y Offline
                yesufollower
                wrote on last edited by
                #7

                Thanks. I am certain that no other user is modifying the record. Could there be a concurrency violation because of some coding error?

                B 1 Reply Last reply
                0
                • Y yesufollower

                  Thanks. I am certain that no other user is modifying the record. Could there be a concurrency violation because of some coding error?

                  B Offline
                  B Offline
                  ben2
                  wrote on last edited by
                  #8

                  can you please post the query that you're using and also the error message

                  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