UPDATE statement in VB.net and an Access database

Aganack1

Senior member
May 16, 2002
331
0
0
So i'm working on a little program that will uses an access database and i'm programing in vb. I'm having major issues with my UPDATE commands.

I keep getting the error messager "Syntax error in the UPDATE statement"

Dim conSurvey As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=survey.mdb")
Dim cmdGet As New OleDbCommand("select * from Users Where Username = '" & CurrentUser.strCurrentUser & "'", conSurvey)
Dim strNewEntry As String = "Update Users Set(HDSurvey = 'true') Where Username = '" & CurrentUser.strCurrentUser.Trim.ToLower & "'"
Dim cmdUpdate As New OleDbCommand(strNewEntry, conSurvey)


Try
conSurvey.Open()
cmdUpdate.ExecuteNonQuery()
Me.Hide()
Dim newHomeForm As New frmSurvey
newHomeForm.Show()


Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conSurvey.Close()
End Try

Me.Hide()

any one got any ideas?
 

BoberFett

Lifer
Oct 9, 1999
37,562
9
81
Been a while since I worked with Access, but have you tried removing the quotes from around 'true'?
 

clamum

Lifer
Feb 13, 2003
26,256
406
126
Remove the partheneses after the SET keyword.

Like this: UPDATE users SET hdsurvey = 'true' WHERE username = '" & CurrentUser.strCurrentUser.Trim.ToLower & "'"
 

BoberFett

Lifer
Oct 9, 1999
37,562
9
81
Oh yeah, durrrrr, brain fart. Parentheses around values are for Inserts, not Updates. Guess I've been out of programming too long.