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. how can i update to access db??

how can i update to access db??

Scheduled Pinned Locked Moved C#
csharpdatabasevisual-studiotutorialquestion
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.
  • N Offline
    N Offline
    nidhelp
    wrote on last edited by
    #1

    hi im using VS .net, MS Access and c# language. basically i tried to do an update command using oleDbDataAdapter and commandbuilder. i also searched for tutorials but i still cant get things going. could someone please tell me how come i couldnt generate update and delete commands using oleDbDataAdapter? i managed to do select command and my parameterized query is working well. i just want to do an update now. what other ways are there for me to do this and also ensure that the changes return correctly to the place that i queried from? if possible, i hope i can do this in IDE instead of programmatically. as im a novice, please pardon me and help me with some step by step instructions whenever possible. thank you. are there any simple walkthrough tutorials that i can follow to accomplish my entire update task? i appreciate it if you could provide me with sample codes or just anything helpful. time's running out... hope to get update going asap.. thanks a lot to all of you! =)

    G M 2 Replies Last reply
    0
    • N nidhelp

      hi im using VS .net, MS Access and c# language. basically i tried to do an update command using oleDbDataAdapter and commandbuilder. i also searched for tutorials but i still cant get things going. could someone please tell me how come i couldnt generate update and delete commands using oleDbDataAdapter? i managed to do select command and my parameterized query is working well. i just want to do an update now. what other ways are there for me to do this and also ensure that the changes return correctly to the place that i queried from? if possible, i hope i can do this in IDE instead of programmatically. as im a novice, please pardon me and help me with some step by step instructions whenever possible. thank you. are there any simple walkthrough tutorials that i can follow to accomplish my entire update task? i appreciate it if you could provide me with sample codes or just anything helpful. time's running out... hope to get update going asap.. thanks a lot to all of you! =)

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      If you provided the error message you get when you try to update, that would have been pretty helpful. If the error message you get is that you need to use an updateable query, it's a very very very common problem. You need to give the user account that runs the code write permission to the database file. --- b { font-weight: normal; }

      N 1 Reply Last reply
      0
      • G Guffa

        If you provided the error message you get when you try to update, that would have been pretty helpful. If the error message you get is that you need to use an updateable query, it's a very very very common problem. You need to give the user account that runs the code write permission to the database file. --- b { font-weight: normal; }

        N Offline
        N Offline
        nidhelp
        wrote on last edited by
        #3

        considering that i only used oleDbAdapter and generated select command, i run my app and query for data from Access db. i then make some changes to the data that are retrieved and displayed in my dataGrid, and i press the update button. update button: private void button3_Click(object sender, System.EventArgs e) { try { oleDbDataAdapter1.Update(dataSet51); MessageBox.Show("Database Updated"); } catch (Exception exceptionObject) { MessageBox.Show(exceptionObject.Message); } } error message: Update requires a valid UpdateCommand when passed DataRow collection with modified rows well i suppose the reason is because i failed to generate the update command using oleDbDataAdapter right?? in that case, what do i do? i do not know how to use a commandbuilder. can you please tell me what to do? thank you! =)

        N 1 Reply Last reply
        0
        • N nidhelp

          considering that i only used oleDbAdapter and generated select command, i run my app and query for data from Access db. i then make some changes to the data that are retrieved and displayed in my dataGrid, and i press the update button. update button: private void button3_Click(object sender, System.EventArgs e) { try { oleDbDataAdapter1.Update(dataSet51); MessageBox.Show("Database Updated"); } catch (Exception exceptionObject) { MessageBox.Show(exceptionObject.Message); } } error message: Update requires a valid UpdateCommand when passed DataRow collection with modified rows well i suppose the reason is because i failed to generate the update command using oleDbDataAdapter right?? in that case, what do i do? i do not know how to use a commandbuilder. can you please tell me what to do? thank you! =)

          N Offline
          N Offline
          nidhelp
          wrote on last edited by
          #4

          i think i should tell you this: i learnt that a missing primary key in my db table might be the cause for my failure to generate the UpdateCommand. i'll be using table2's data to generate the UpdateCommand. hence i tried to add a pk, but i could not save my changes. (error is something like this: saving will cause duplicate pk) well, i suppose it's because i already had a pk (IDno )in table1, and what i was trying to do was to let IDno in table2 be pk as well. in the end, i have only one pk (IDno in table1). i meant to let IDno be pk in all of my tables... is this possible?? one thing to note: i used oleDbDataAdapter to generate commands using table1 and all the commands were successfully generated. i think i succeeded because i've a pk in table1, am i right?? hope that's helpful for you to understand my problem.. please help me... i donno how i should rectify the problem (to make an UpdateCommand for table2 and be able to update back to Access db). thanks for reading.

          1 Reply Last reply
          0
          • N nidhelp

            hi im using VS .net, MS Access and c# language. basically i tried to do an update command using oleDbDataAdapter and commandbuilder. i also searched for tutorials but i still cant get things going. could someone please tell me how come i couldnt generate update and delete commands using oleDbDataAdapter? i managed to do select command and my parameterized query is working well. i just want to do an update now. what other ways are there for me to do this and also ensure that the changes return correctly to the place that i queried from? if possible, i hope i can do this in IDE instead of programmatically. as im a novice, please pardon me and help me with some step by step instructions whenever possible. thank you. are there any simple walkthrough tutorials that i can follow to accomplish my entire update task? i appreciate it if you could provide me with sample codes or just anything helpful. time's running out... hope to get update going asap.. thanks a lot to all of you! =)

            M Offline
            M Offline
            mostafa_h
            wrote on last edited by
            #5

            send me an email for recieving a free sample in c#.net database . my email:nmm705@yahoo.com Mostafa

            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