"Enumeration yielded no results" When using Query Syntax in C#
Posted
by Shantanu Gupta
on Stack Overflow
See other posts from Stack Overflow
or by Shantanu Gupta
Published on 2010-05-26T05:41:27Z
Indexed on
2010/05/26
5:51 UTC
Read the original article
Hit count: 2901
I have created this query to fetch some result from database. Here is my table structure.
What exaclty is happening.
DtMapGuestDepartment as Table 1
DtDepartment as Table 2
Are being used
var dept_list= from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID")
join
dept in DtDepartment.AsEnumerable()
on map.Field<Nullable<long>>("DEPARTMENT_ID") equals dept.Field<Nullable<long>>("DEPARTMENT_ID")
select dept.Field<string>("DEPARTMENT_ID");
I am performing this query on DataTables and expect it to return me a datatable.
Here I want to select distinct department from Table 1 as well which will be my next quest. Please answer to that also if possible.
© Stack Overflow or respective owner