Insert CheckBox.Checked status into database

rtlxzfyvvf

New Member
I thought this would be simpler but its giving me trouble. I basically want a user to check a few boxes and then add each individual checkbox to a row in a table. I tried a CheckBoxList but decided to just add each Checkbox individually. Basically this is my code:\[code\] Using cn2 As New SqlConnection(connectionString) Dim cmd2 As New SqlCommand If chkActions.Checked = True Then cmd2 = New SqlCommand("Insert into [Turns] (Actions) VALUES ('1'", cn2) cn2.Open() cmd2.ExecuteNonQuery() cn2.Close() End If End Using\[/code\]The Actions row is a bit datatype, so as far as I know its just a 1, 0 or NULL. It gives me an "Incorrect Syntax near..." error. If anyone can spot the error or maybe a better way of doing this I would be truly grateful.
 
Back
Top