开发者

Linq to sql type comparison

开发者 https://www.devze.com 2022-12-14 10:08 出处:网络
I have a varialbe name age and that\'s type is int? My linq to sql query is: from t in db.Profiles where t.age == age select t

I have a varialbe name age and that's type is int? My linq to sql query is:

from t in db.Profiles where t.age == age select t

having a comparison between int and int? at where clause. how the query p开发者_StackOverflowrocessor of linq to sql will process in this case?


If age is a type int? then I believe your query should read as follows:


from t in db.Profiles where t.age == age.Value select t

0

精彩评论

暂无评论...
验证码 换一张
取 消