I am using a PassThroughQuery to show only distinct rows from a certain table. I have no choice this table has duplicates and I don't want to show the duplicates in a drop down combo box.
I do the following,
public LocalBanch[] GetLocals()
{
PassThruRdbQuery query = new PassThruRdbQuery(typeof(LocalBranch), "Select distinct [Local] from LocalBranch order by [Local]");
LocalBranch[] locals = (LocalBranch[]) myPM.GetEntities(query);
return locals
}
in my form I have a bindingsource as follows
LocalBS.DataSource = myController.GetLocals();
In my Control Binding Manager, I want to set the LocalComboBox to LocalBranch, which is the relationship between the member table and the LocalBranch table. I set the ListConverter to LocalBS and Local as the field to display. Incidentally Local is the only field being returned.
I get the combo box displaying the distinct values but I also get the red exclamation point and the following is the error message when the user selects from the combo box.
Object reference not set to the instance of an object.
Any suggestions or is there a better way of doing this?
Bill