Update statement not working?
I'm stuck with my update statement for a access2000 file.
I have a table called email with 2 fields. (name and email)
I can Add to it just fine, but I can't update.
This is what I have
in my access table I have
Name Email
perry [email protected]
peter [email protected]
value1 = "newname"
Dim mycn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:/donation.mdb")
Dim mycmd As OleDbCommand = New OleDbCommand
mycmd.Connection = mycn
mycmd.CommandText = "UPDATE email SET name=value1 WHERE name='perry' AND email='[email protected]')"
mycn.Open()
mycmd.ExecuteNonQuery()
mycn.Close()
it will fail on mycmd.ExecuteNonQuery()
What am I doing wrong?