• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

UPDATE statement in VB.net and an Access database

Aganack1

Senior member
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?
 
Remove the partheneses after the SET keyword.

Like this: UPDATE users SET hdsurvey = 'true' WHERE username = '" & CurrentUser.strCurrentUser.Trim.ToLower & "'"
 
Oh yeah, durrrrr, brain fart. Parentheses around values are for Inserts, not Updates. Guess I've been out of programming too long.
 
Back
Top