Hi


Im using a DataGrid to display and modify a table from an Access DB.

To do this I create a DataSet and fill it with MS Access database.
I then bind the DataGrid to the Dataset so the datagrid automatically displays everything.

I would like to use this DataGrid as my main editing for the Database including Updating/Deleting/Inserting.

But im having trouble working out If i need to insert/update or delete.

Basically when my application closes I wish to save the contents of the DataGrid ( which is binded to a DataSet ) back into a table in a MDB.

So users can delete rows, add rows and update rows.
Then when they exit, I wish to update the MDB table with all the changes from the DataSet.

How can I do this?
Currently this is what im doing

VB Code:
  1. Dim oCB As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(oAdp)
  2.         Dim oComm As OleDb.OleDbCommand = oCB.GetUpdateCommand()
  3.  
  4.         Try
  5.             '-- Updates the Database with the new item list
  6.             oAdp.Update(dsMyItems, "MyItems")
  7.  
  8.         Catch ex As OleDb.OleDbException
  9.             Console.WriteLine(ex.Message)
  10.         End Try
  11.  
  12.         '-- Close the connection, we dont need to keep it open (or do we?)
  13.         oConn.Close()

but the Try code catches an error when records have been added or delete.