c# - Unexpected empty sequence in linq to sql result -


i have simple query deletes entry table

        cb_user_schedule deleted = (from x in db.cb_user_schedules                                     x.scheduleid == currentscheduleid                                     select x).single();         db.cb_user_schedules.deleteonsubmit(deleted);         db.submitchanges(); 

however, first statement returns sequence contains no elements. can see when executes value of currentscheduleid in fact number , when directly execute select * cb_userschedules scheduleid = 3 return row. why statement not finding row in database?

check emitted sql built-in linq-to-sql logging (hook textwriter log property on datacontext) or sql profiler. more you've got datatype mismatch or key issue in dbml (ie, doesn't match reality in db , mapper barfing on it). run large , complex site exclusively on l2s, , these kinds of issues related broken dbml.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -