SqlCommand comm = new SqlCommand("select * from EmpDetail"); SqlDataAdapter adap = new SqlDataAdapter(comm); comm.Connection = conn; DataSet ds = new DataSet(); adap.Fill(ds); comboBox1.Text = "-select-"; foreach(DataRow dr1 in ds.Tables[0].Rows) { comboBox1.Items.Add(dr1["EmpName"].ToString()); }
if(ComboBox1.Items.Count>0) { ComboBox1.Items.Insert(0, "Select Item"); ComboBox1.SelectedIndex = 0; }
ComboBox1.Items.Insert(0, new ComboBoxItem("-Select-", string.Empty));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)