Saving Edited Data to Database from a form

riccolmars

Member
Joined
Mar 18, 2012
Messages
12
Programming Experience
Beginner
I am a beginner to visual basic and have done a little bit on coding but not to much, the confusion is that i have created a form with the "details" from the DataSet so i can Edit the info, there is a binding navigator with only the navigations left on as i deleted save add and delete as i have them as a button on the form..
Now the confusion, i can edit the information and when i save it and close the form and refresh the datagridview it appears up to date, well as i only have 3 in the database just to test things out, the top 2 can be edited and when i edit and save them the new details appear on the refreshed datagridview, but the bottom\last one in the database, doesnt changed its info when i save on the 'edit' page... can anyone have any reason why it doesnt edit the last 3rd person in the database but it does edit the top 2.. ? the code i have entered which seemed to work was...

Me.Validate ()
Me.TblPupilsBindingSource.EndEdit
Me.TableAdapterManger.UpdateAll (Me.BlankPupilsDataSet)
MsgBox ("Save Successful")

as i said since it edits 2 out of the 3 it should be working but with it not editing the 3rd person and i just cant seem to figure out how to make it happen. Anyone that can pass on any info that will help in the slightest, it will be much appreciated, as i said due to me being a beginner, i would appreciate if someone wouldnt just post a reply saying all the jibberish and me not understanding it, i would appreciate the jibberish if it was followed by an explanation and reasoning .

Hopefully someone out there will understand the situation and will be able to help, i cant seem to move on till it is fixed so the help will be so much appreciated,

Again Thanks for the help, if possible.
 
sorry i have unable to contact you sooner, my disability had me in hospital overnight so just got well enough to use the pc again, i have tried many different scenarios and it seems to be the last record that i edit is the one that doesnt change, if i edit all 3 in the order 1,2,3 the 3rd doesnt change, if i edit 3,2,1 then 1 doestn change... this is the same if i only try with 2 people aswell, if i edit 1 & 2.. then 1 changes and 2 doesnt.. if i edit 2 then 1 . 2 changes ..1 doesnt and if i edit just a single record and try to save to the database when i load the datagrid the single record has not been edited, i hope all this over explaining isnt too much i just wanted to be really clear about it, i dont understand why this is happening and ive been trying all day (im in UK) to figure out why by looking up on internet and watching vids and everything seems to not be sinking in... what is it that needs to do to sort the situation out ?
Again thanks for the time and effort to respond and help me it is much appreciated!
 
well here are 2 pics, 1 of the code and one of the design view, when i run the code and edit the data in the database, all but the last edited 'record' is saved, so when i close and refresh the datagridview then the last one that i edited did save but the others did, and then if i add a new record then it doesnt create a new one till i click the button a second time, then it creates 2 ... and when i fill then in and save them again the last one filled in didnt save, but then the delete button works fine and deletes the current row, but if i add to many at once, and by to many it is different all times an error appears saying

Me.Validate ()
Me.TblPupilsBindingSource.EndEdit
Me.TableAdapterManger.UpdateAll (Me.BlankPupilsDataSet) <--------------------'Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
MsgBox ("Save Successful")

i understand that breakpoints stops the program mid run so you can see the program brokendown into sections but i dont understand how i would use them, i understood that if there was a programme the program wouldnt run, but clearly theres problems and it runs is there anything you can see wrong that needs sorting or just any tips and help would be appreciated
CodeModeAddForm.jpgDesignModeAddForm.jpg

again thanks for all the time and effort you put in to see if theres anything u can do for me , so thanks it is really appreciated
 
Back
Top