我遇到麻烦我似乎无法使我的SQL查询正确
Dim command1 As New MySqlCommand("UPDATE userscanner SET Username ='" & txtbox_username.Text & "',Password='" & txtbox_password.Text & "' WHERE ID = '" & lbl_id.Text & "')", Connection)
command1.ExecuteNonQuery()
MsgBox("Profile Successfuly Saved")
Me.Close()
但我有错误说"你的sql语法有错误;查看适用于您的MySQL服务器版本的手册,以获得正确的语法,以便在附近使用')'在第1行
BTW我使用XAMPP和MYSQL作为数据库
答案 0 :(得分:0)
试试这个:
Dim command1 As New MySqlCommand("UPDATE userscanner SET Username ='" & txtbox_username.Text & "',Password='" & txtbox_password.Text & "' WHERE ID = '" & lbl_id.Text & "'", Connection)
command1.ExecuteNonQuery()
MsgBox("Profile Successfuly Saved")
Me.Close()
答案 1 :(得分:0)
你似乎包括了一个')'在构造sql语句时关闭没有开头的paranthesis
答案 2 :(得分:0)
我认为你需要删除')'。
Dim command1 As New MySqlCommand("UPDATE userscanner SET Username ='" & txtbox_username.Text & "',Password='" & txtbox_password.Text & "' WHERE ID = '" & lbl_id.Text & "'", Connection)
答案 3 :(得分:0)
你有多余的')'
校正:
Dim command1 As New MySqlCommand("UPDATE userscanner SET Username ='" & txtbox_username.Text & "',Password='" & txtbox_password.Text & "' WHERE ID = '" & lbl_id.Text & "'", Connection)
command1.ExecuteNonQuery()
MsgBox("Profile Successfuly Saved")
Me.Close()
答案 4 :(得分:0)
您应该使用参数化更新查询