title: "Opened exclusively be another user" when reading data from CSV by C#
body: <p>I am running the code below in asp.net 4.5 solution and it gives me the error:</p>
  
  <blockquote>
    <p>The Microsoft Jet database engine cannot open the file ''.  It is
    already opened exclusively by another user, or you need permission to
    view its data.</p>
  </blockquote>
  
  <p>The code follows:</p>
  
  <pre><code>private static string FileConnectionString(string filePath)
  {
      return string.Format(WebConfigurationManager.AppSettings["DataFileCSV"].ToString(), filePath);
  }
  </code></pre>
  
  <hr>
  
  <pre><code>string DataUploadFolder = WebConfigurationManager.AppSettings["DataFileUploadFolder"].ToString();
  string filePath = HttpContext.Current.Server.MapPath(DataUploadFolder);
  
  OleDbConnection fileConnection = new OleDbConnection(FileConnectionString(filePath));
  try
  {
      fileConnection.Open();
      string columnList = "Col1, Col2, Col3, Col4, Col5";
      DataTable fileDataTable = new DataTable();
      OleDbCommand command =  new OleDbCommand(string.Format("SELECT {0} FROM [{1}]",                                                                   
                                               columnList,
                                               FileUploadControl.FileName), 
                                  fileConnection);
      OleDbDataAdapter da = new OleDbDataAdapter(command);
      da.Fill(fileDataTable); //Exception occurs here !!
  }
  catch (Exception ex)
  {
  
  }
  finally
  {
      fileConnection.Close();
  }
  </code></pre>
  
  <p><strong>Web.config:</strong></p>
  
  <pre><code> &lt;add key="DataFileCSV" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='text;HDR=Yes;FMT=Delimited';" /&gt;
  </code></pre>
  
  <p>Please note that the CSV file is not open anywhere. No file is open actually, only Visual Studio is open. I can open the file, change and save it as well. "Everyone" has "full control" permission on the file. </p>
  
  <p>I can't see why the error is happening, could not find a way to fix it. Seen many pages with this error but no solution worked so far. Any help would be greatly appreciated.</p>
  
  <p>Edit: In aspx, I use: <code>&lt;asp:FileUpload ID="FileUploadControl" runat="server" Width="400px" /&gt;</code></p>