Wednesday, 7 August 2013

Displaying 2 columns in one combobox

Displaying 2 columns in one combobox

I have an employee table. I want the combobox to present the employee
number and city.
SqlCommand cmd = new SqlCommand();
Connection c = new Connection();
cmd.CommandText = "SELECT employeeNumber, city FROM tblEmployee";
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds, "Employee");
comboBox1.DataSource = ds;
That's what I got so far, can anyone help me with that?

No comments:

Post a Comment