开发者

LinqToSql returns null when using Single - not sequence contains no elements [duplicate]

开发者 https://www.devze.com 2022-12-08 19:41 出处:网络
This question already has answers 开发者_开发百科here: Closed 13 years ago. Possible Duplicate: Linq help - Sql trace returns result, but datacontext returning null
This question already has answers 开发者_开发百科here: Closed 13 years ago.

Possible Duplicate:

Linq help - Sql trace returns result, but datacontext returning null

Question 1579164

I tried changing to .Single instead of .SingleOrDefault and the object I get back is null, not 'sequence contains no elements' error. When I use SQL profiler and capture the SQL that is generated, I run the query and get 1 result. What would cause the object to be null?

Thanks for any help, ~ck


perhaps your field/properties mapping in your DBML is not correct

0

精彩评论

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