locked
External table is not in the expected format RRS feed

  • Question

  • Hello everyone!

    I'm developing an Web Application (C#) on a Windows 7 Enterprise (x64), with Office 2007 using Visual Web Developper 2010 Express. On that project that reads information from Excel files like so:

    protected void Page_Load(object sender, EventArgs e)
        {
          string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\1.xlsx;Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"";
          OleDbConnection oleDbConn = new OleDbConnection(connString);
          try
          {
            oleDbConn.Open();
            OleDbCommand oleDbComm = new OleDbCommand("SELECT * FROM [Sheet1$]", oleDbConn);
            OleDbDataAdapter oleDbDtAdapter = new OleDbDataAdapter();
            oleDbDtAdapter.SelectCommand = oleDbComm;        
            oleDbConn.Close();
          }
          catch (Exception evt)
          {
            Response.Write("ERRO: " + evt.Message.ToString());
          }
        }
     On the development PC everything works as it should and I am able to open both XLS and XLSX Files.

    Now, passing this simple code to my deployment server wich has Windows Server 2003 R2 Standard X64 Edition (SP2) I had to install Access Database Engine 2007 (only for x86) since there was no Office 2007 on the server, so after the instalation, and deploying this simple code to the server I got  IErrorInfo.GetDescription failed with E_FAIL(0x80004005) error.

    Some more searching and I found out that there was an Access Database Engine 2010, this time for bot x86 and x64 architectures so I thought duuhhh now It's gona work.

    After installing Access Database Engine 2010 voila I was able to access XLS file but for XLSX I'm now getting this crazy error:

    External table is not in the expected format

     

    I've been banging my head for almost a day now, but still can't understand why this is happening!

     

     

    Saturday, January 22, 2011 4:31 PM

Answers

All replies