ConnectionString to open .xlsx

Discussion in 'ASP.NET / ASP.NET Core' started by ahablives, Oct 23, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Greetings fellow travelers,
    I use the following ConnStr to open and copy data from both Excel 2007 and older (.xls and .xlsx). Everything works great locally for both however; when I upload to DiscountASP Excel 2007 throws "External table not in expected format" Connection string works fine for .xls files.

    string fileNamePath = "FileStore/ValueLine.xlsx";
    string sSourceConstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath(fileNamePath) + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\";";


    why would all work locally and only excel 2007 throw

    "External table is not in the expected format." when I upload to Discount ASP

    Thx for any help.
    -Ahab
     
  2. Ahab,

    Did you get an answer. I have the exact same issue.
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. Pauldaniel

    Pauldaniel Guest

    Hi

    Try this code

    Dim strConnection, conn, rs, strSQL

    strConnection = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;" & _
    "Dbq=" & Server.MapPath(".\excel\myExcelFile.xls") & ";"

    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open strConnection


    Thanks,
    Paul daniel
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page