title: When reading a CSV file using a DataReader and the OLEDB Jet data provider, how can I control column data types?
body: <p>In my C# application I am using the Microsoft Jet OLEDB data provider to read a CSV file. The connection string looks like this:</p>
  
  <pre><code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data;Extended Properties="text;HDR=Yes;FMT=Delimited
  </code></pre>
  
  <p>I open an ADO.NET OleDbConnection using that connection string and select all the rows from the CSV file with the command:</p>
  
  <pre><code>select * from Data.csv
  </code></pre>
  
  <p>When I open an OleDbDataReader and examine the data types of the columns it returns, I find that something in the stack has tried to guess at the data types based on the first row of data in the file. For example, suppose the CSV file contains:</p>
  
  <pre><code>House,Street,Town
  123,Fake Street,Springfield
  12a,Evergreen Terrace,Springfield
  </code></pre>
  
  <p>Calling the OleDbDataReader.GetDataTypeName method for the House column will reveal that the column has been given the data type "DBTYPE_I4", so all values read from it are interpreted as integers. My problem is that House should be a string - when I try to read the House value from the second row, the OleDbDataReader returns null.</p>
  
  <p>How can I tell either the Jet database provider or the OleDbDataReader to interpret a column as strings instead of numbers?</p>