I was trying to update the data to the access database while displaying the same data in datagridview. I was using binding source and table adapter for that purpose. I keep receiving this "Update requires a valid InsertCommand when passed DataRow collection with new rows" error. It is a multiple form project and the same code is used in another form and it works fine. What could be the source of this error and how to get rid of it?
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Try
UsersBindingSource.EndEdit()
UsersTableAdapter.Adapter.Update(MRStudioDataSet3.Users)
st = 1
MessageBox.Show("Changes Saved")
Catch exc As System.Data.ConstraintException
MessageBox.Show("Username Already Taken", "Username Uniqueness Violation", MessageBoxButtons.OK, MessageBoxIcon.Warning)
UsersBindingSource.RemoveCurrent()
End Try
End Sub