Here is my behind code
strCon = ConfigurationManager.ConnectionStrings["MotorConnectionString"].ConnectionString;
foreach (ListItem li in CheckBoxList1.Items)
{
if (li.Selected == true)
{
using (SqlConnection sqlcon = new SqlConnection(strCon))
{
using (SqlCommand sqlcmd = new SqlCommand("INSERT INTO testProduct VALUES (@PolNo,@Business,@Type,@Product1,@Product1.@Product3)"))
{
sqlcmd.CommandType = CommandType.Text;
sqlcmd.Parameters.AddWithValue("@PolNo", TextBox1.Text);
sqlcmd.Parameters.AddWithValue("@Business", DropDownList1.SelectedValue);
sqlcmd.Parameters.AddWithValue("@Type", DropDownList2.SelectedValue);
sqlcmd.Parameters.AddWithValue("@Product1", CheckBoxList1.SelectedValue);
sqlcmd.Parameters.AddWithValue("@Product2", CheckBoxList1.SelectedValue);
sqlcmd.Parameters.AddWithValue("@Product3", CheckBoxList1.SelectedValue);
sqlcmd.Connection = sqlcon;
sqlcon.Open();
sqlcmd.ExecuteNonQuery();
sqlcon.Close();
}
}
}