I'm trying to interface with an access database with vb.net, but I'm getting errors when I try to update using the DataAdapter. The basic function of this sub is to update the password of a user in the "Employee" table of the database. Here's the code for the "Update" button on the form.
I've got the command builder setup in the public module "Global" as well, using the following: "Public cb As New OleDb.OleDbCommandBuilder(da)"
Whenever I run the code i get an error on the line mentioned above, it reads:
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'."
Sorry for the long post but I figured the more information the better
Thanks for the help,
zandsc1
VB.NET:
///beginning code removed (just checking string length etc)
sql = "SELECT * FROM Employees WHERE Employee = '" & lblUser.Text & "'"
///Global is a module with a setup ds sub that takes a string and dataset and
///sets them up using the public string variable "sql"
Global.SetupDs("ChangePW", ds1)
If txtOldPW.Text <> ds1.Tables("ChangePW").Rows(0).Item("Password") Then
MsgBox("Old password does not match employee records.")
txtOldPW.Text = ""
txtNewPW.Text = ""
txtConfirmNewPW.Text = ""
Exit Sub
End If
///"Password" is the field in the "Employees" table that I want to edit
ds1.Tables("ChangePW").Rows(0).Item("Password") = txtNewPW.Text
/// The following line is where I'm getting the error:
da.Update(ds1)
MsgBox("Password Updated.")
///END SUB
I've got the command builder setup in the public module "Global" as well, using the following: "Public cb As New OleDb.OleDbCommandBuilder(da)"
Whenever I run the code i get an error on the line mentioned above, it reads:
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'."
Sorry for the long post but I figured the more information the better
Thanks for the help,
zandsc1