Question Updatine Access DB with VB basic 2008

NCombs

Member
Joined
Jun 1, 2012
Messages
9
Programming Experience
1-3
I have a datagrid that is loaded from a data source called ManualKanBanDataSet. The Access DB is ManualKanban, the table is "Parts". I've set the column properties of the column I want to change to readonly=false.

I make changes to the data in the datagrid, click my update button and nothing updates. here is the update code:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Me.Validate()
Me.ManualKanbanDataSet.AcceptChanges()
Me.PartsTableAdapter.Update(Me.ManualKanbanDataSet.Parts)
MsgBox("Update successful")
Catch ex As Exception
MsgBox("Update failed")
End Try
End Sub

I get an "Update Successful, but it really doesn't update.
Help!
 
OK

If the Table doesn’t have a Primary Key then this error will occur. So all you have to do is edit the database and ensure that at least one column is identified as a Primary Key. This could be the name column – although more realistically I would add an auto-numbering identity column which will ensure that all values in that column are unique. Resave everything, recreate a new DataSet, replace the DataGridView as before, and you’re good to go. As usual, the answer is simple when you know it – incredibly frustrating when you don’t. Hope it solves the pronlem.
 
Back
Top