Hi, thanks for prior reply. I have another question on EF. Got stuck on it last night and this morning, narrowed it down WHERE the error is occurring but I do not understand WHY the error occurs.
Code:
var userCheck = (from check in profileEnt.scAccounts
where check.asp_userId == userID
select check).FirstOrDefault();
When I run this code, I get
"Error: Sys.WebForms.PageRequestManagerServerErrorExceptio n: This property cannot be set to a null value."
#1 When I
change FirstOrDefault() to Count(), it works: returns "1".
#2 When I
remove FirstOrDefault(), it works: returns "System.Data.Objects.ObjectQuery`1[Sc2Saga.scAccount]"
#3 When I
remove FirstOrDefault() and use Anonymous Types (e.g., Select new), it works.
When I replace FirstOrDefault() with
SingleorDefault(), it fails.
So I see WHERE the error occurs, but I do not understand WHY it fails.
As a workaround, can I use step #2? If so, how do I retrieve the first record in the collection?
Help is greatly appreciated ...
- Nano