The only thing I can guess is that you have created the Categories table without a primary key? I don't know, but I just tried this block of code using the sample Northwind database that comes with Microsoft Access, and it worked perfectly fine:
Private Const DataPath As String = _ "D:\Program Files\Microsoft Office\" & _ "Office11\Samples\Northwind.mdb"
Public Shared ReadOnly _ OleDbConnectionString As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & DataPath
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles Button1.Click Dim cn As New OleDbConnection(OleDbConnectionString)
Dim strselect As String = "SELECT Categories.* FROM Categories " Dim da As New OleDbDataAdapter(strselect, cn)
Dim autogen As New OleDbCommandBuilder(da)
Dim ds As DataSet = New DataSet da.Fill(ds, "Categories")
Dim dt As DataTable = ds.Tables("Categories")
Dim row As DataRow = _ dt.Select("categoryName = 'Dairy Products'")(0) row("Description") = "Milk"
da.Update(ds, "Categories") cn.Close() End Sub
Can you try it with the sample that comes with Access? Otherwise, I can't see why it wouldn't work... |