title: How do I get an DataTable from IDataReader?
body: <p>I'm trying to get a <code>DataTable</code> or <code>DataSet</code> from an <code>IDataReader</code>, but I'm failing. Here's the code:</p>
  
  <pre><code>string sql = @"SELECT ID, DOCNUMBER FROM TBDOCUMENT";
  
  using (IDbConnection conn = CreateConnection(provider, connectionString))
                  {
                      conn.Open();
                      using (IDbCommand command = conn.CreateCommand())
                      {
                          command.CommandText = sql;
                          IDataReader reader = command.ExecuteReader();
  
                          using (reader)
                          {
                              while (reader.Read())
                              {
                                  long key = reader.GetInt64(0);
                                  decimal value = reader.GetDecimal(1);
                              }
                          }
                      }
                  }
  </code></pre>
  
  <p>I'm using <code>IDbConnection</code> and <code>IDbCommand</code> because it will works with three different databases (the method <code>CreateConnection(provider, connectionString)</code> gets the specific type of connection according to the database).
  My query gets an ID (as Int64) and a DocNumber (as Decimal), but every time I try to get the decimal value, it throws an <code>OverflowException</code> with a message: "Conversion overflows." Both of values are important to me, but I don't know how do I get these values.</p>
  
  <p>Actually, the code I'm not trying to convert to a <code>DataTable</code>, I have to get the value of the two without exception.</p>
  
  <p>Some help?</p>