this Save give me checkboxlist items in one row i want any items in sprate row (webForm-sqlserver):
thanks
void save()
{
CultureInfo engcul = new CultureInfo("en-US");
try
{
//*****
string strBidType = "";
foreach(ListItem cBox in ChlEngine.Items) {
if(cBox.Selected) {
strBidType += cBox.Text.ToString() + " / ";
}
//********
string str = "Data Source=(local);Initial Catalog=cooling;Trusted_Connection=True";
con = new SqlConnection(str);
con.Open();
string sql = "INSERT into Cooling_Table (Eng_Name,Engineer_Name,EnterringTime) values ('"
+ strBidType + "','"
+ ddlEngineer.SelectedItem.Text + "','"
//+ ddlEmpName.SelectedItem.Text + "','"
//+ txtPcNumber.Text + "','"
//+ txtComAc.Text + "','"
//+ ddlserviceType.SelectedItem.Text + "','"
+ System.DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss", engcul.DateTimeFormat) + "')";
cmd = new SqlCommand(sql,con);
//cmd.Connection = con;
cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
Label2.Text = (ex.Message);
}
finally
{
if (con.State == ConnectionState.Open)
con.Close();
}
}