不正确的语法附近' vb.net

时间:2017-09-10 16:57:37

标签: sql vb.net visual-studio user-input sqlcommand

我收到错误Incorrect syntax near 's'。在SQL中输入数据后出现错误有时它不会出现但是当输入相同的字符时会出现错误。 错误在ExecuteNonQuery

中排列
conn = New SqlConnection(constr)
conn.Open()
comm = New SqlCommand("Insert into Admins(Firstname, Lastname, Birthday, Contact, Email, Address, Username, Password, SecurityQ1, SecurityQ2, SecurityI1, SecurityI2, SecurityA1, SecurityA2, Type) values ('" & BunifuMetroTextbox1.Text & "','" & BunifuMetroTextbox2.Text & "','" & BunifuDatepicker1.Value & "','" & BunifuMetroTextbox3.Text & "','" & BunifuMetroTextbox8.Text & "','" & BunifuMetroTextbox9.Text & "','" & BunifuMetroTextbox4.Text & "','" & BunifuMetroTextbox5.Text & "','" & BunifuDropdown1.selectedValue & "','" & BunifuDropdown2.selectedValue & "','" & BunifuDropdown1.selectedIndex & "','" & BunifuDropdown2.selectedIndex & "','" & BunifuMetroTextbox6.Text & "','" & BunifuMetroTextbox7.Text & "','" & admintype & "')", conn)
affector = comm.ExecuteNonQuery
conn.Close()

0 个答案:

没有答案