Hello there,
Now I am stuck with at a point where I need to insert the selected text from the Dropdowncheckboxes into the database. The code I am using is as follows:
string message = string.Empty;
foreach (ListItem item in DropDownCheckBoxes1.Items)
{
if (item.Selected)
{
message += item.Text;
OleDbConnection cn3 = new OleDbConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["globe"].ConnectionString);
cn3.Open();
OleDbCommand cmd2 = new OleDbCommand("INSERT INTO prdCountries (prdID, countryName) values (@prdID, @countryName) ", cn3);
cmd2.Parameters.AddWithValue("@prdID", "10");
cmd2.Parameters.AddWithValue("@countryName", message);
cmd2.ExecuteNonQuery();
cn3.Close();
}
}
Please guide me as to where i am going wrong.