title: xlsx file upload not working correctly - works when file is open but not when closed
body: <p>I've been doing research on this problem for about a day and a half and haven't found a solution to my problem yet. This is my scenario:</p>
  
  <p>I have a AsyncFileUpload and a button which is configured to accept only xls and xlsx files (Excel) file. This file that is uploaded is used to import information into a gridview. The old format xls files works fine. The problem comes when I want to upload the xlsx file. I've tested multiple scenarios and I have found that it works perfectly when the xlsx file is currectly/actively open. When it is closed it gives me errors. I have fiddled and explored solutions to this problem and the range of errors I have received is quite large. But the most prominent errors where the following:<br>
   1. External table is not in the expected format.
   2. could-not-find-installable-isam</p>
  
  <p>I have found an article relating to the second error (<a href="https://stackoverflow.com/questions/4214527/could-not-find-installable-isam">Could not find installable ISAM</a>) but I haven't tried all the suggested solutions yet because I would rather avoid making changes to the windows registry because I do not have exstensive knowledge regarding this matter.</p>
  
  <p>I'm attaching the code that I use to make the connection between the OleDb and the excel file:</p>
  
  <pre><code>protected void AsyncUpload_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
  {
      string connString = "";
      string strFileType = Path.GetExtension(e.FileName).ToLower();
      string path = e.FileName;
      ////Connection String to Excel Workbook
      if (strFileType.Trim() == ".xls")
      {
          connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
      }
      else if (strFileType.Trim() == ".xlsx")
      {
          connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;HDR=Yes;IMEX=1";
      }
  
      string query = "SELECT * FROM [sheet1$]";
      OleDbConnection conn = new OleDbConnection(connString);
      if (conn.State == ConnectionState.Closed)
         conn.Open();
      OleDbCommand cmd = new OleDbCommand(query, conn);
      OleDbDataAdapter da = new OleDbDataAdapter(cmd);
      DataSet ds = new DataSet();
      da.Fill(ds);
  
       using (OleDbDataReader dr = cmd.ExecuteReader())
      {
          _InsertWrapper.clearLists();
          while (dr.Read())
          {
              var row1Col0 = dr[0];
              Console.WriteLine(row1Col0);
              _InsertWrapper.GenerateList(dr);
          }
      }
       da.Dispose();
       conn.Close();
       conn.Dispose();
       InventoryGrid.DataBind();
       ErrorsGrid.DataBind();        
  }
  </code></pre>
  
  <p>If someone has additional knowledge or an explanation that can contribute please add it so that more people that are struggling with the same type of problem can gain as much information from this question as possible.We are all still learning.</p>
  
  <p>So, main idea: Need to find a solution to successfully upload the xlsx file</p>