Print Page | Close Window

distinct queries

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1079
Printed Date: 13-Apr-2026 at 8:16pm


Topic: distinct queries
Posted By: BillG
Subject: distinct queries
Date 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
 



Print Page | Close Window