Sie Ste

Sie Ste

  • NA
  • 196
  • 179.1k

C# linq issue

Oct 1 2012 2:00 AM
I have a C# 2010 application that I would like to add the following lines of code:
eDataContext rData = new eDataContext();
DateTime complete_date = (DateTime)(from a in rData.cust
                           where a.PkID == pkId
                           select a.Complete_Date).FirstOrDefault();
if (complete_date != null)

The linq statement where DateTime complete_date is assigned a value works.
However when I try to executed the line of code
(complete_date != null),

the program has a problem on this line of code. I found this out by stepping though the
code.

Thus can you tell me why the
"if (complete_date != null)" line of code is having a problem? Also can you tell me what to
do to solve the problem?

Answers (3)