Hi,
I was not able to insert the selected values of a checkbox list into the table.
Could you please help me out..
Thanks in advance!
The code I tried is:
public void btnClick()
{
con1.Open();
for (int i = 0; i < 4; i++)
{
CheckBoxList2.SelectedIndex = i;
if (CheckBoxList2.Items[i].Selected)
{
SqlCommand cmd1 = new SqlCommand("insert into DART_IDC_ADD_PROC_MAP(DAR_ID,ADD_PROC_SEL) values (123,'" + CheckBoxList2.Items[i].Text.ToString() + "'", con1);
cmd1.ExecuteNonQuery();
}
i++;
MessageBox.Show("Inserted "+CheckBoxList2.SelectedValue.ToString());
}
da = new SqlDataAdapter("insert into DART_IDC_ADD_PROC_MAP values (123,"+i.ToString(), con1);
}