This is my save code
There is error when I try to save
Error Message ( Syntax error INSERT INTO statement )
I have checked my database table it's same to my code
The error image in under the code
Public Sub adduser()
Try
If conn.state = connectionstate.closed Then
conn.Open()
End If
Dim cmd As New oledbcommand
cmd.connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "INSERT INTO login ([name], email, phone, username, password, role_1, inventory_1, delete_1, update_1, settings_1, backup_1, reports_1, employee_1, loan_1, debt_1) VALUES (@name, @email, @phone, @username, @password, @role_1, @inventory_1, @delete_1, @update_1, @settings_1, @backup_1, @reports_1, @employee_1, @loan_1, @debt_1)"
cmd.parameters.addwithvalue("@name", textbox5.text.trim)
cmd.Parameters.AddWithValue("@email", TextBox5.Text.Trim)
cmd.Parameters.AddWithValue("@phone", TextBox3.Text.Trim)
cmd.parameters.addwithvalue("@username", textbox1.text.trim)
cmd.parameters.addwithvalue("@password", textbox2.text.trim)
cmd.Parameters.AddWithValue("@role_1", ComboBox1.Text.Trim)
cmd.Parameters.AddWithValue("@inventory_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@delete_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@update_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@settings_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@backup_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@reports_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@employee_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@loan_1", CheckBox1.Checked)
cmd.Parameters.AddWithValue("@debt_1", CheckBox1.Checked)
cmd.ExecuteScalar()
conn.close()
userregistration.loadaccounts()
msgbox("Added")
textbox1.text = ""
textbox2.text = ""
textbox3.text = ""
textbox4.text = ""
textbox5.text = ""
combobox1.text = ""
checkbox1.checked = False
checkbox2.checked = False
checkbox3.checked = False
checkbox4.checked = False
checkbox5.checked = False
checkbox6.checked = False
checkbox7.checked = False
checkbox8.checked = False
checkbox9.checked = False
checkbox10.checked = False
Catch ex As Exception
MsgBox("Error !: " + ex.Message)
End Try
End Sub
