private void btnUpdateSupport_Click(object sender, EventArgs e) { SqlConnection con = Helper.getconnection(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.Text; string SupportName = txtSupportName.Text; string SupportDesignation = txtSupportDesignation.Text; //string SupportStatus = txtSupportStatus.Text; string SupportStatus = cbSupportStatus.SelectedItem.ToString(); //string SupportStatus = SqlCommand(); int i = 0; string s = "Active"; // string result = int.TryParse(s, out i); if (cbSupportStatus.SelectedItem != null) { int x = int.Parse(cbSupportStatus.SelectedItem.ToString()); } else { //Value is null } cmd.CommandText = "Update Status1 set Designation='" + SupportDesignation + "', Status='" + SupportStatus + "' where Name= '" + SupportName + "' "; MessageBox.Show(cmd.CommandText); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } }
SelectedItem
struct
class
ToString()
System.Object.ToString()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)