Reputation: 1198
I am using EntitySpaces 2012 architecture which provides ORM mapping and built-in methods to write your SQL query using it's libraries (just like LINQ to SQL). The problem is, I cannot select distinct rows from a table using EntitySpaces Select Query. Currently, I am doing it as follows
DataTable dt = new DataTable();
ActualData objAct = new ActualDataQuery();
objAct.Select(objAct.Year.Distinct);
dt = objAct.LoadDataTable();
if (dt.Rows.Count > 0)
{
FillCombo(dt);
}
I have put a breakpoint as well on the line where my datatable object is getting load, and it is showing that the distinct rows are present there multiple times (means distinct not working).
I have also go through the complete documentation of EntitySpaces but there's nothing regarding distinct keyword. Also I found nothing on the internet related to this problem as there's no forum for EntitySpaces2012. Any help would be hugely appreciated!
Upvotes: 1
Views: 800
Reputation: 8591
Here is a sample of Select distinct query from http://esdocs.pixeo.be/:
EmployeesQuery q = new EmployeesQuery("e");
q.es.Distinct = true;
q.Select(q.EmployeeID);
You can use Distinct method too.
So, your query might look like:
DataTable dt = new DataTable();
ActualData objAct = new ActualDataQuery();
objAct.Distinct = true;
objAct.Select(objAct.Year);
dt = objAct.LoadDataTable();
Note: i'm not familiar with EntitySpaces.
Good luck!
Upvotes: 1