Populating ComboBox
<p>i have this questions... my scenario is to populate combobox from the database and display customer name and hold a value of the id...my id i use identity increment...tnx</p>

<pre><code>SqlConnection conn = new SqlConnection(connectionString);
conn.Open();

//SelectCustomerById(int x);
comboBoxEx1.Items.Clear();

SqlCommand comm = new SqlCommand("spSelectCustomerByID", conn);
//comm.Parameters.Add(new SqlParameter("cust_name", cust_name));
//comm.CommandText = "spSelectCustomerByID";
comm.Parameters.Add(new SqlParameter("cust_id", SqlDbType.Int));
comm.CommandType = CommandType.StoredProcedure;
comm.ExecuteNonQuery();

SqlDataAdapter sdap = new SqlDataAdapter(comm);
DataSet dset = new DataSet();
sdap.Fill(dset, "cust_registrations");

if (dset.Tables["cust_registrations"].Rows.Count &gt; 0)
{
    comboBoxEx1.Items.Add("cust_registrations").ToString();
}
comboBoxEx1.DataSource = dset;
comboBoxEx1.DisplayMember = "cust_name";
</code></pre>
