how to get the selected value of check-box in asp.net
I am trying to get the selected value of the check-box but it is always showing zero in the back-end table even when i select the check-box. The data type for the check-box is bit. I am not sure what am i doing wrong here.
using (SqlConnection con = new SqlConnection(strConnString)) { using (SqlCommand cmd = new SqlCommand(@"insert into myTable(UserID, Name) values( @UserID, @Name)")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@UserID", tempUser.ToString()); cmd.Parameters.AddWithValue("@Name", chckNM.Checked); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); }
sorry even though i closed the question but i hope you could help me. I want to retrieve the data and this is the syntax i am want to use but it is not quite right yet