title: Linq and DBNull - Getting error
body: <p>I'm getting an error when selecting from a rows.AsEnumerable(). I am using the following code...  </p>
  
  <pre><code>var rows = ds.Tables[0].AsEnumerable();
                  trafficData = rows.Select(row =&gt; new tdDataDC
                  {
                      CalculationCount = row.Field&lt;Int64&gt;("biCalculationCountSeqID")
                      , Zone = row.Field&lt;Int16&gt;("siFkZoneId")
                      , Miles = row.Field&lt;decimal&gt;("dcMiles")
                      , Plaza = row.Field&lt;Int16&gt;("siFkPlazaId")
                      , VehicleCount = row.Field&lt;int&gt;("iVehicleCount")
  
  
                  });
  </code></pre>
  
  <p>Most of the time it works well, but when there are NULLS in the database I'm getting this error "Cannot cast DBNull.Value to type 'System.Int16'. Please use a nullable type.."
  How can I correct this? I don't want my datacontracts to have Nullable types, I'd like to use a ternary or something, and if a value is NULL, just use 0. Is this possible?</p>
  
  <p>Thanks for any help,<br>
  ~ck</p>