title: Store Excel Sheet data to sql server
body: <p>I am getting error message like </p>
  
  <blockquote>
    <p>Format of the initialization string does not conform to specification starting at index 0.</p>
  </blockquote>
  
  <p>While exporting an Excel file. Please advise</p>
  
  <p>This is my code:</p>
  
  <pre><code>string file = string.Format("{0}\\{1}", Request.PhysicalApplicationPath,Guid.NewGuid().ToString().Replace("-",string.Empty));
  fileuploadExcel.SaveAs(file);
  
  //Create connection string to Excel work book
  string excelConnectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0;HRD=YES;IMEX=1'", fileuploadExcel.PostedFile.FileName);
  
  //Create Connection to Excel work book
  OleDbConnection excelConnection =new OleDbConnection(file);
  
  //Create OleDbCommand to fetch data from Excel
  OleDbCommand cmd = new OleDbCommand("Select [ID],[Name],[Desi] from [Varun]", 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>