1

While uploading Excel files to DB server some files cannot be uploaded. This error was caused while getting the column names of that excel file using the function:

dtExcel = objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, Nothing)
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
chinnu
  • 145
  • 3
  • 4
  • 11
  • What error you are getting? Provide more details. – Anuraj May 12 '11 at 11:45
  • objconn="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\inetpub\wwwroot\FileUploadV2\FlatFile\FOD_Feb2011_31jan11_Upd_001_1-4.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES" this is the connection string im using. and dtexcel is the datatable. im binding the column names of that excelfile to a datatable. while binding im getting this error 'Unexpected error from external database driver (1).' – chinnu May 12 '11 at 11:58
  • On which OS. Win 7 / XP / Server ? – Anuraj May 12 '11 at 12:03
  • Windows 7 os. only some excel files throwing the error – chinnu May 12 '11 at 12:18

1 Answers1

1

Seems like problem with Excel OLEDB driver and/or connection string

Try these posts

  1. Diagnosing an OLEDB exception when Quering Excel 2010
  2. http://connectionstrings.com/excel-2007
Community
  • 1
  • 1
Anuraj
  • 18,859
  • 7
  • 53
  • 79
  • hey if ter is the problem in connection string as you said i cannot upload other excel 2010 files too. but while uploading some files only im getting this error.... thanks – chinnu May 12 '11 at 12:32
  • Excel 2007 or Excel 2010 Files? – Anuraj May 12 '11 at 12:41
  • 4
    got the solution i have included imex=1 in the connection string. before i didnt include this so it treats as the excel data. when i put this code it treats all the data as text and shows the columnname. – chinnu May 27 '11 at 11:46
  • I encountered this issue after a colleague of mine decided to install Excel on the server. This action seemed to update or replace Microsoft Access Database Engine 2010 Redistributable drivers we used before. Adding IMEX=1 fixed the problem. Also, if before I had to compile my Windows service for Any CPU to use the drivers on 64-bit server, with Excel installed, I have to compile for x86 to make everything work. – Alex Polkhovsky Jan 24 '12 at 00:35