简体   繁体   中英

Strange behavior of Entity Framework query

Below query yielded no results even when there was matching record in the DB. 在此输入图像描述

  • Even the query generated will yield the result when executed in DB.
  • Also, query yields the result when "order by" is added to the query.
  • No changes in the query parameters.
  • Same query works for dev database, yields no result in QA database.
  • There is no change in the QA database compared to Dev.

在此输入图像描述

I think you need to add filter for the ADMINGROUP

var currentDept = (from d in dbContext.TBLZLISTDEPTs
where d.ADMINGROUP != null
select new 
{
   d.ADMINGROUP
}).FirstOrDefault();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM