Updating my database

  • Thread starter Thread starter Ibajat
  • Start date Start date
I

Ibajat

Hi everyone!
I'm having a problem with my database and I just can't find the solution for
this.. I am just doing a database in VB NET linked with Access, everything is
fine until I want to edit/update the data that is already in the Database.

It just saves the information on VB NET but it does not pass the edited
information to Access... I dont know where my mistake is and I already
searched a lot...

Can anyone please help me?
Thanks in advance for all your help

-----
Private Sub btnUpdateEdited_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnUpdateEdited.Click

If MessageBox.Show("Do you really want to SAVE it?", "Save"
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.No Then

MsgBox("Operation Cancelled!")
AddressBookDataSet.tblFirst.RejectChanges()
Else

Me.AddressBookDataSet.tblFirst.AcceptChanges()
Me.TblFirstTableAdapter.Update(Me.AddressBookDataSet.tblFirst)
Try
Me.Validate()
Me.TblFirstBindingSource.EndEdit()
Me.TblFirstTableAdapter.Update(Me.AddressBookDataSet.tblFirst)
MsgBox("Update successful")

Catch ex As Exception
MsgBox("Update failed")
End Try
Exit Sub
End If
End Sub
 
It's been a while since I did any ADO.NET stuff, but if I remember
correctly, I think the problem is that you're calling AcceptChanges before
calling Update. Try checking what the documentation says about the
AcceptChanges method, and if that doesn't solve the problem for you, maybe
ask the question in an ADO.NET forum. I'm pretty sure its an ADO.NET thing
and not Access-specific.
 
Back
Top