title: Transfer data from Excel sheet into SQL Server database
body: <p>I have an Excel sheet that contains some data. I want to store that data into a SQL Server  database from that aspx page.</p>
  
  <p>I am trying to store data but get error as below:</p>
  
  <blockquote>
    <p><em>The Microsoft Office Access database engine cannot open or write to the file.
    It is already opened exclusively by another user, or you need permission to view and write its data.</em></p>
  </blockquote>
  
  <p>This is my code:</p>
  
  <pre><code>string excelConnectionString = @"provider=Microsoft.ACE.OLEDB.12.0;data source=" + path + ";extended properties='Excel 12.0;HDR=YES;'";
  
  //Create Connection to Excel work book
  OleDbConnection excelConnection =new OleDbConnection(excelConnectionString);
  //Create OleDbCommand to fetch data from Excel
  OleDbCommand cmd = new OleDbCommand("Select [ID],[Name],[Designation] from [Sheet1$]",excelConnection);
  excelConnection.Open();
  OleDbDataReader dReader;
  dReader = cmd.ExecuteReader();
  SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection);
  //Give your Destination table name
  sqlBulk.DestinationTableName = "Excel_table";
  sqlBulk.WriteToServer(dReader);
  excelConnection.Close();
  </code></pre>
  
  <p>and thanks in advance ...</p>