title: "Specified cast is not valid" in LINQ when DateTime field is null
body: <p>I got a problem. This my code use a LINQ.</p>
  
  <pre><code>var resultCases = from row2 in dtCases.AsEnumerable()
                    where row2.Field&lt;int&gt;("caseID") == caseID2
                    select new
                    {
                                caseName = row2["caseName"].ToString(),
                                caseCourtPlace = row2["caseCourtPlace"].ToString(),
                                caseCourtRef = row2["caseCourtRef"].ToString(),
                                caseOfficeRef = row2["caseOfficeRef"].ToString(),
                                effectiveDate = ((DateTime)row2["caseEffectiveDate"]),
                                closedDate = ((DateTime)row2["caseClosedDate"]),
                                caseFolderPath = row2["casesFolderPath"].ToString(),
                                category = row2["categoryName"].ToString(),
                                department = row2["departmentName"].ToString(),
                                empName = row2["empName"].ToString(),
                                judgeName = row2["judgeName"].ToString(),
                                asName = row2["asCasesName"].ToString(),
                    };
  </code></pre>
  
  <p>If <code>closedDate</code> or <code>effectiveDate</code> return <code>DBnull.Value</code>, I get</p>
  
  <blockquote>
    <p><em>InvalidCastException was unhandled - Specified cast is not valid.</em></p>
  </blockquote>
  
  <p>So how can I prevent this error?</p>