Inserting selected CheckBoxList values in to db
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
        SqlConnection conn = new SqlConnection("mydatasource");

        string cbspecialities = string.Empty;

        foreach (ListItem li in CheckBoxList1.Items)
        {
            if (li.Selected)
            {
                cbspecialities += li.Value + ", ";
            }
        }

        conn.Open();

        string sql = "Insert into tblml (Names) VALUES('" + cbspecialities + "')";

        SqlCommand cmd = new SqlCommand(sql, conn);

        cmd.ExecuteNonQuery();

        conn.Close();
</code></pre>

<p>it is not inserting in to the table ..</p>

<p>where is the problem ?</p>

<p>Please help </p>

<p>Thnks</p>
