Can't work distinct

Posts   
 
    
ironcross
User
Posts: 31
Joined: 12-May-2006
# Posted on: 18-May-2006 12:33:49   

Somewhere i have read that if i use this code it automatically distinct all replied rows but when i use it i doesn't do that.confused What's problem? thanx in advance

private void comboBox1_Click(object sender, EventArgs e) {

        PersonTableCollection persontable = new PersonTableCollection();
        comboBox1.DataSource = persontable;
        comboBox1.DisplayMember = "Title";
        persontable.GetMulti(null);
    }
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 18-May-2006 14:20:39   

You have a PK on your table, don't you? GetMulti() returns all the records of a table, and they should be distinct.

ironcross
User
Posts: 31
Joined: 12-May-2006
# Posted on: 18-May-2006 14:43:00   

no very pity that i don't have pk for this field. There are many same reecords in this table ,i must choose only distinct fields. if there has no solution of this product then i must change my table configurationrage

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 18-May-2006 15:13:18   

It's better to have a PK.

Also you may do the following: Use a dynamic list or a typed list and specify when you fetch it that allowduplicates should be false. See in the documentation: Using the generated code -> Selfservicing/adapter -> Using views and lists -> Using dynamic lists (or usign the typedlist classes).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 18-May-2006 18:11:39   

You can set the PK fields in the designer: open the entity in the editor, then select the field which should be the PK, and check the checkbox to make it part of the PK. Save, regenerate.

Frans Bouma | Lead developer LLBLGen Pro
ironcross
User
Posts: 31
Joined: 12-May-2006
# Posted on: 23-May-2006 08:59:44   

all the options here is passive(may be it allows to change this options when the table is empty.in my case it's not empty)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 23-May-2006 09:50:00   

ironcross wrote:

all the options here is passive(may be it allows to change this options when the table is empty.in my case it's not empty)

What exactly do you mean with 'all options here is passive' ?

Frans Bouma | Lead developer LLBLGen Pro