title: OleDB Can't Retrieve Rows With Different DataType
body: <p>I am trying to retrieve <code>DataTable</code> from .xls file. Below are my code:</p>
  <pre><code>OleDbConnection MyConnection = null;
  DataSet DtSet = null;
  OleDbDataAdapter MyCommand = null;
  MyConnection = new OleDbConnection(&quot;provider=Microsoft.Jet.OLEDB.4.0; Data Source='&quot; + path + &quot;';Extended Properties=Excel 8.0;&quot;);
  
  //path is where the .xls file located
  ArrayList TblName = new ArrayList();
  
  MyConnection.Open();
  DataTable schemaTable = MyConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, &quot;TABLE&quot; });
  foreach (DataRow row in schemaTable.Rows)
  {
      TblName.Add(row[&quot;TABLE_NAME&quot;]);
  }
  
  MyCommand = new System.Data.OleDb.OleDbDataAdapter(&quot;select * from [&quot; + TblName[0].ToString() + &quot;] order by Material&quot;, MyConnection);
  DtSet = new System.Data.DataSet();
  
  MyCommand.Fill(DtSet);
  MyCommand.FillSchema(DtSet, SchemaType.Source);
  
  DataTable dt = new DataTable();
  dt = DtSet.Tables[0];
  MyConnection.Close();
  </code></pre>
  <p>Problem is: <strong>I have some inconsistent rows in my table</strong>, meaning <strong>they don't follow the other rows datatype</strong>.</p>
  <p>Let's say in column A, I have cells that are supposed to be like:</p>
  <blockquote>
  <p>105161610</p>
  <p>146161701</p>
  <p>196171717</p>
  <p>.........</p>
  </blockquote>
  <p>Meaning to say it's supposed to be of <code>Int32</code> datatype.</p>
  <p>These are the majority of the column cells..</p>
  <p>I also have some other cells (still in the same column) that look like:</p>
  <blockquote>
  <p>ABC9012</p>
  <p>KDJ0981</p>
  <p>KLP0001</p>
  <p>.......</p>
  </blockquote>
  <p>They somehow follow <code>string</code> datatype.</p>
  <p>When I execute the code, I can only <code>Select</code> cells of <code>int</code> type while cells having the other type (<code>string</code>) is set to <code>null</code> instead. Although in my code I basically set the <code>select *</code> explicitly.</p>
  <p>Can someone advise me on how to consistently retrieve both kind of datatype (instead of only 1 like what happens now)?</p>