New Posts New Posts RSS Feed: distinct queries
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

distinct queries

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: distinct queries
    Posted: 03-Feb-2009 at 10:55am
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
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down