J Trahair
Well-known member
I am trying to edit a record found in the database as follows:
VB.NET:
Dim objDs As DataSet
Dim ObjDa As OleDbDataAdapter
Dim objRow As DataRow
Dim objTable As DataTable
Dim objColumn As DataColumn
mstrSQL = "SELECT * FROM ItemsSold WHERE ProductCode = 'T468' AND Colour = 'Blue'"
objDs = New DataSet()
ObjDa = New OleDbDataAdapter(mstrSQL, mstrOLEConnectionString)
ObjDa.Fill(objDs, "ItemsSold")
MsgBox(objDs.Tables(0).Rows(0).Item("UnitPrice"))
MsgBox(objDs.Tables(0).Rows(0).Item("RecNo"))
'These message boxes show the data correctly.
objDs.Tables(0).Rows(0).Item("UnitPrice") = 19.60 'New price of the T468
ObjDa.Update(objDs, 0) <<<<<<<< error message:
Please can you tell me what I've (not) done. Thank you.Update unable to find TableMapping['0'] or DataTable '0'.
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at LearnWinForm.frmTextBoxesAndComboboxes.Button3_Click(Object sender, EventArgs e) in C:\My Documents\NET Blank\LearnWinForm\TextboxesAndComboboxes.vb:line 284