title: Strange error when filling a data adapter
body: <p>I am receiving the following error in my code (c#, .Net 3.5, VS2008) when I try to connect to an Excel sheet and fill a OleDbDataAdapter with the results of a query. First the error:</p>
  
  <blockquote>
    <p>Attempted to read or write protected memory. This is often an
    indication that other memory is
    corrupt.</p>
  </blockquote>
  
  <p>And here is the code, which is honestly pretty simple:</p>
  
  <pre><code>var excelFileName = @"c:\Metadata_Tool.xlsm";
  var connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; Data Source={0}; Extended Properties=Excel 12.0;HDR=YES;", excelFileName);
  
  var adapter = new OleDbDataAdapter("Select * FROM [Video Tagging XML]", connectionString);
  var ds = new DataSet();
  
  adapter.Fill(ds, "VTX");
  
  DataTable data = ds.Tables["VTX"];
  
  foreach (DataRow myRow in data.Rows)
  {
      foreach (DataColumn myColumn in data.Columns)
      {
          Console.Write("\t{0}", myRow[myColumn]);
      }
      Console.WriteLine();
  }
  
  Console.ReadLine();
  </code></pre>
  
  <p>I get the error on the line <code>adapter.Fill(ds,"VTX");</code>. I did find a microsoft forum post saying to turn on JIT optimization in VS2008 from the Tools/Options/Debug/General menu, but this did not seem to help. Any help would be greatly appreciated thanks!</p>