title: Specified cast not valid Dataset
body: <p>I have a stored procedure that returns 4000 records</p>
  
  <pre><code>SELECT 
  cast(Number as bigint) as Number
  FROM  TableTest
  </code></pre>
  
  <p>This query runs fine and returns the results</p>
  
  <p>However when i do this in the C# </p>
  
  <pre><code>    public static MDTSearchResult MDTSearchResultReader(SqlDataReader rdr)
      {
          MDTSearchResult r = new MDTSearchResult();
          {
              r.person = new person()
              {
                  Number = (long)rdr["Number"]
              }
          }
          return r;
      }
  </code></pre>
  
  <blockquote>
    <p>I get an error saying specified cast not valid, on this</p>
  </blockquote>
  
  <p>I have checked the length of all records in the returned data set (Column Number) they are all a length of 10 and are all bigints.</p>
  
  <p>Is there any other reason for this.</p>
  
  <p>Also I have debugged in VS and noticed it gets through the first 500 records ( i did then stop as it was too time consuming.)</p>
  
  <p>Thanks</p>