how can i update to access db??
-
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! =)
-
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! =)
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; }
-
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; }
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! =)
-
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! =)
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.
-
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! =)
send me an email for recieving a free sample in c#.net database . my email:nmm705@yahoo.com Mostafa