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();
它没有插入到表中..
问题出在哪里 ?
请帮忙
谢谢