在 C# 中使用查询语法时,“枚举未产生结果”。如何检索输出
我创建了这个查询来从数据库中获取一些结果。 这是我的表结构< /a>.
到底发生了什么。
DtMapGuestDepartment如表1
Dt部门如表2
正在使用
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");
我正在执行此查询 DataTables 并期望它返回我 数据表。
在这里,我想从表 1 中选择不同的部门,这将是我的下一个任务。如果可能的话也请回答这个问题。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将查询分成几部分,看看哪个集合没有元素。
break your query into parts and see which collection has no elements.