I'm getting an odd error when trying to update a database through a DataAdapter.

Here is a simplified version of the problem in code:

VB Code:
  1. Private Sub frmTemp_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.     Dim cn As OleDb.OleDbConnection
  3.     Dim da As OleDb.OleDbDataAdapter
  4.     Dim cb As OleDb.OleDbCommandBuilder
  5.     Dim ds As New DataSet()
  6.     Dim dr As DataRow
  7.     Dim sSql As String
  8.  
  9.     cn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
  10.     "Data Source=" & Application.StartupPath() & "\dbAppraiser.mdb")
  11.  
  12.     sSql = "SELECT * From tblParticipants " & _
  13.     "ORDER BY iParticipantID"
  14.     da = New OleDb.OleDbDataAdapter(sSql, cn)
  15.     cb = New OleDb.OleDbCommandBuilder(da)
  16.  
  17.     da.Fill(ds, "tblParticipants")
  18.  
  19.     ds.Tables("tblParticipants").Rows(2).Item("sFirstName") = "Tom"
  20.     ds.Tables("tblParticipants").Rows(2).Delete()
  21.  
  22.     da.Update(ds, "tblParticipants")
  23. End Sub

Now, the database connection works fine. I can read the rows from the DataSet without any problem in another section of the application.

If I comment out the line that deletes a row it works without a hitch. The database is updated, everything is happy.

However, if the delete statement is used I have been getting the following error:

"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"

This error does not occur on the ...Delete() line but when the DataAdapter is updated. When I checked the DataSet the row is deleted and acts properly in all ways that I coudl tell.

The worst part is that it used to work (all of this code is of course spread through the application) but I had trouble deleting the row the user was looking at (something I assumed to do with the way I had assigned the row to a new DataRow object). However, even now that I have distilled it down to the bare minimum it still fails.

Any ideas?

Tom