sjn78 Posted June 3, 2003 Posted June 3, 2003 I have a access table with an ID field that is auto incremented. Problem is, I cant seem to do update query's when i use the ID field. I narrow my selection to the person I want to make the updates to and then grab the id of the row and assign it to playid. Dim objCommand As New OleDbCommand("UPDATE Contacts WHERE ID = '" & playid & _ "' SET Firstname = '" & StrConv(txtFirstname.Text, VbStrConv.ProperCase) & _ "', MiddleName = '" & StrConv(txtMiddleName.Text, VbStrConv.ProperCase) & _ "', Surname = '" & StrConv(txtSurname.Text, VbStrConv.ProperCase) & _ "'", cnn) I end up getting this error: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll I have found though, if I change the objcommand to update where the surname = something, it works fine. Has anyone come across this or is it just me? Thanks Steve Quote
sjn78 Posted June 3, 2003 Author Posted June 3, 2003 Im slapping myself across the face now...... The id field is an integer and my syntax was telling it to look for text...eg, I had id as '2' instead of 2 Very silly mistake, but you learn by mistakes!!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.