简体   繁体   中英

SYNTAX error with Update statement VB.NET

I have a SYNTAX error in the UPDATE statement. Plz Help.

cmd.CommandText = "UPDATE tbl_User SET ([Score], [Level])VALUES(@User_Score, @User_Level) WHERE User=@User"
cmd.Parameters.AddWithValue("@User_Score", lblScore.Text)
cmd.Parameters.AddWithValue("@User_Level", lblLevel.Text)
cmd.Parameters.AddWithValue("@User", txtUser.Text)

Thanks

您使用的是INSERT语法样式,而不是UPDATE语法:

UPDATE tbl_User SET [Score] = @User_Score, [Level]= @User_Level WHERE User=@User

cmd.CommandText = "UPDATE tbl_User " & vbCrLf & "SET User_Score=@User_Score," & vbCrLf & "User_Level=@User_Level" & vbCrLf & "WHERE User=@User"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM