c# - linq query methods all throwing NotSupportedException -


i have code:

    var qry = d in _dbentities.day               d.date == datetime.now.date               select d;     day day = qry.single(); 

it's throwing notsupportedexception when try , run it. should returning 0 results, there 0 in there, , therefore should throwing invalidoperationexception. i'm having same problem qry.count(), , far can tell of methods of iqueryable. i've looked ways count query , use these methods

ef may trying convert datetime.now.date expression not compatible provider. try making variable instead:

var today = datetime.now.date;  var qry = d in _dbentities.day           d.date == today           select d; day day = qry.single(); 

the reason exception on single because query not executed until try , use (via foreach, tolist, count, single, etc.). makes look like problem single when real problem query itself.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -