Question

I'm using the DevExpress XtraReport, my query returns two records, but only appears in Detail 1. Can anyone tell me the reason? Below is the code of the method responsible for loading the DataSource.

Tks!

using (xEntities con = new xEntities())
{
    var result = from m in con.Table1
            join u in con.Table1 on m.Table2Id equals u.Table1Id
            where u.Description.Equals("xxxx")
            select new { m.Name, u.Description };

    DataSource = result.ToList();

    labelDescription.DataBindings.Add("Text", DataSource, "Description");
    labelName.DataBindings.Add("Text", DataSource, "Name");
}
Was it helpful?

Solution

Well either your LINQ query syntax is wrong or only one of your entities' description satifies the where clause.

Try the following:

var result = from t1 in con.Table1
             join t2 in con.Table2 on t1.ID equals t2.ID
             where t1.Description.Equals("someDescription")
             select new { ... };
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top