title: Read excel via ADO.NET with SQL Server commands?
body: <p>I <strong>can</strong> read XLS file with this code : </p>
  
  <pre><code>string path =@"c:\r\1.xlsx";
  OleDbConnection MyConnection = new OleDbConnection(@"provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + path + @"';HDR=Yes;Jet OLEDB:Engine Type=37");
  OleDbDataAdapter MyCommand = new OleDbDataAdapter("select * from [Sheet1$]", MyConnection);
  DataSet DtSet = new DataSet();
  MyCommand.Fill(DtSet);
  ...
  ...
  </code></pre>
  
  <p>However - when I enhance the query to include some SQL Server commands like</p>
  
  <pre><code> select *,case when 1=1 then 'a' else 'b' end as rr  from [Sheet1$]
  </code></pre>
  
  <p>it goes BANG</p>
  
  <p><img src="https://i.stack.imgur.com/ubOwb.jpg" alt="enter image description here"></p>
  
  <p>I know that <code>OLEDB</code> is using <code>access</code> jet/ace behind the scenes.</p>
  
  <p>How can use pure T-SQL query here?</p>