本文介绍了实体框架select()隐藏数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用distinct()选择所有唯一(过期日期):



 gridView3.Columns [0] .FieldName = pis_ExpireDate; 

var EXdates = DB0201.purchases_item_seriels.Where(u =>(u.stitems_ID == ItemID&& u.ss_StoreID == StoreID&& u.pis_Statues == 0)| |
(u.stitems_ID == ItemID&& u.ss_StoreID == StoreID&& u.pis_Statues == 5)||
(u.stitems_ID == ItemID&& u.ss_StoreID == StoreID&& u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpireDate).Select(u => u.pis_ExpireDate).Distinct();

gridControl3.DataSource = EXdates.ToList();



行已创建,但没有数据显示!!



我尝试了什么:



i尝试选择所有数据而不用选择(u => u.pis_ExpireDate),它的工作原理



 gridView3.Columns [0] .FieldName =pis_ExpireDate; 

var EXdates = DB0201.purchases_item_seriels.Where(u =>(u.stitems_ID == ItemID&& u.ss_StoreID == StoreID&& u.pis_Statues == 0)| |
(u.stitems_ID == ItemID&& u.ss_StoreID == StoreID&& u.pis_Statues == 5)||
(u.stitems_ID == ItemID&& u.ss_StoreID == StoreID&& u.pis_Statues == 6))
.OrderBy(o => o.pis_ExpiraeDate);
gridControl3.DataSource = EXdates.ToList();



行创建并显示所有数据但没有合并

解决方案

i try to select all unique (expired dates) with distinct() :

gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
                                                                                (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
                                                                                (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
                                                                                .OrderBy(o => o.pis_ExpireDate).Select(u => u.pis_ExpireDate).Distinct();

    gridControl3.DataSource = EXdates.ToList();


rows created but no data appears!!

What I have tried:

i tried to select all data without Select(u => u.pis_ExpireDate) , it work

gridView3.Columns[0].FieldName = "pis_ExpireDate";

var EXdates = DB0201.purchases_item_seriels.Where(u => (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 0) ||
                                                                                (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 5) ||
                                                                                (u.stitems_ID == ItemID && u.ss_StoreID == StoreID && u.pis_Statues == 6))
                                                                                .OrderBy(o => o.pis_ExpiraeDate);
    gridControl3.DataSource = EXdates.ToList();


rows created and all data appear but without merge

解决方案


这篇关于实体框架select()隐藏数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 18:01