Reputation: 1179
I'm trying to populate a combobox from a dataset with only specific rows, this is my code:
comboBox2.DataSource = glObalDataSet.Tables["JOBURI"].Select(
"CONT = '" + comboBox1.SelectedValue.ToString() + "'");
The dataset works fine, it is populated, can someone show me where i'm doing wrong?
Upvotes: 1
Views: 16011
Reputation: 94625
Use DataView to filter the result.
DataView dv=glObalDataSet.Tables["JOBURI"].DefaultView;
dv.RowFilter="CONT = '" + comboBox1.SelectedValue.ToString() + "'";
comboBox2.DataSource=dv;
comboBox2.DisplayMember="JOB";
comboBox2.ValueMember="ID";
You need to set Display
and Value
member property of Combobox control.
Upvotes: 5