deano1
May 21st, 2002, 10:10 AM
Hi All,
I can't seem to get the UpdateCommand that comes with .NET to work. Keep getting runtime error saying:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'.
My code is underneath, If anyone can explain why this is happening and help me put it right i would be grateful!! As its doing my head in.
Dim db As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\helpdesk.mdb;")
Dim faultsDA As OleDbDataAdapter = New OleDbDataAdapter("SELECT userName, uniqueIdent FROM faults", db)
faultsDA.UpdateCommand = New OleDbCommand("UPDATE Categories SET userName = 'testing' ")
'faultsDA.UpdateCommand.Parameters.Add("@userName", OleDbType.VarChar, 15, "userName")
Dim faultsDS As DataSet = New DataSet()
faultsDA.Fill(faultsDS, "faults")
Dim cRow As DataRow = faultsDS.Tables("faults").Rows(0)
faultsDA.Update(faultsDS)
I can't seem to get the UpdateCommand that comes with .NET to work. Keep getting runtime error saying:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'.
My code is underneath, If anyone can explain why this is happening and help me put it right i would be grateful!! As its doing my head in.
Dim db As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\helpdesk.mdb;")
Dim faultsDA As OleDbDataAdapter = New OleDbDataAdapter("SELECT userName, uniqueIdent FROM faults", db)
faultsDA.UpdateCommand = New OleDbCommand("UPDATE Categories SET userName = 'testing' ")
'faultsDA.UpdateCommand.Parameters.Add("@userName", OleDbType.VarChar, 15, "userName")
Dim faultsDS As DataSet = New DataSet()
faultsDA.Fill(faultsDS, "faults")
Dim cRow As DataRow = faultsDS.Tables("faults").Rows(0)
faultsDA.Update(faultsDS)