Listbox.displaymember property

Nov 20 2005 11:45 PM
Hi
I m having a proble with the following code..

private void comboBox1_Click(object sender, EventArgs e)

{

SpecialType = comboBox1.SelectedItem.ToString();

string sql = "select doctors.doctorname+' '+doctors.doctorlname from doctors ,SpecializationTypes ,SDT ";

sql = sql + " where SpecializationTypes.SpecializationTypeID = doctors.Specilization ";

sql = sql + " and doctors.hospitalcode = SDT.hospitalcode";

sql = sql + " and SDT.hospitalname = " + "'" + textBox1.Text + "'";

sql = sql + " and SpecializationTypes.SpecializationType = " + "'" + SpecialType + "'";

SqlCommand mySqlCommand = new SqlCommand(sql);

mySqlCommand.Connection = mySqlConnection;

SqlDataAdapter adapter1 = new SqlDataAdapter(mySqlCommand);

DataSet ds1 = new DataSet();

adapter1.Fill(ds1);

listBox2.DataSource = ds1;

listBox2.DisplayMember = "doctorname"; 

}
what should be the displaymember property of this listbox2

as when I click on combobox it displays..
System.Data.DataViewManagerListItem TypeDescriptor in Listbox2..

Can anybody help????


Answers (1)