C# – LinqToSql returns null when using Single – not sequence contains no elements

clinq-to-sql

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

Best Answer

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