shortssize = S中查询表达式中字符串中的语法错误

时间:2018-05-14 06:05:10

标签: sql vb.net syntax syntax-error

我使用此代码更新MS Access中的条目,但它始终返回错误。我不知道哪个部分要纠正。请帮助我,我似乎无法找到哪个部分是错误

enter image description here

Private Sub SaveChanges()
    con.ConnectionString = OpenDBConnection()
    con.Open()
    Dim sql As String = "Update [JobOrderProd] set [CustomerOrderNumber] = 
    '" & CustomerOrderNumtxtbox.Text & "', [ItemNumber] = '" &
        ItemNumbertxtbox.Text & "', [JerseyName] = '" & 
       JerseyNametxtbox.Text & "', [JerseyNumber] = '"`
        & JerseyNumbertxtbox.Text & "', [JerseySize] = '" & 
          JerseySizetxtbox.Text & "', 
        [ShortsSize] = '" & ShortsSizetxtbox.Text
    Dim cmd As New OleDbCommand(sql, con)`enter code here`
    cmd.ExecuteNonQuery()`enter code here`
    con.Close()
    MsgBox("Entry for JO Production has been updated.")
    ClearForm()
End Sub

1 个答案:

答案 0 :(得分:1)

我觉得你最后错过了单个倒置的逗号。将其添加到最后& "'"

JerseySizetxtbox.Text & "', 
[ShortsSize] = '" & ShortsSizetxtbox.Text & "'"