Incorrect syntax near '4'

后端 未结 4 1454
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 00:51

I have an INSERT code where the variable s = 4. Help would be pretty appreciated.

 con.Open()
            Dim cmd As New SqlCommand(\"INSERT INTO Employee VALUES         


        
4条回答
  •  粉色の甜心
    2021-01-29 01:53

    You missed the closing parenthesis. Change it like

    Dim cmd As New SqlCommand("INSERT INTO Employee VALUES('" & txtfname.Text & "','" & txtmi.Text & "','" & txtlname.Text & "','" & txtssn.Text & "','" & txtbdate.Text & "','" & txtaddress.Text & "','" & cmbsex.Text.ToUpper & "','" & txtsalary.Text & "','" & DBNull.Value & "','" & s & "')", con)
    

提交回复
热议问题