Using OLEDB 4.0 to read excel spreadsheet doesn't work on vista32

Discussion in 'ASP .Net' started by David, Jan 13, 2009.

  1. David

    David Guest

    Hi - i have coded a page that opens an excel spreadsheet using oledb and it
    works fine when i run it on an XP environment but on vista 32 it opens the
    spreadsheet but cannot find the sheet (ie: table). keep getting Message =
    "The Microsoft Jet database engine could not find the object 'schedule$'.
    Make sure the object exists and that you spell its name and the path name
    correctly.". The path is correct, the sheet name is correct. Again, works on
    XP but not Vista. tks.

    code

    Protected Function GetDivision() As Data.OleDb.OleDbCommand

    ' Connect to the Excel Spreadsheet
    Dim xConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("schedule.xls") & ";" & _
    "Extended Properties=Excel 8.0;"
    ' create your excel connection object using the connection string
    Dim objXConn As New Data.OleDb.OleDbConnection(xConnStr)
    Dim sqlStr As String = "SELECT DISTINCT [Div] FROM [schedule$] order
    by [Div]"
    objXConn.Open()

    Dim objCommand As New Data.OleDb.OleDbCommand(sqlStr, objXConn)
    Return objCommand

    End Function
     
    David, Jan 13, 2009
    #1
    1. Advertising

  2. David

    David Guest

    Re: Using OLEDB 4.0 to read excel spreadsheet doesn't work on vist

    Thanks for your prompt reply. i did peform numerous searches prior posting
    and found nothing that helped. my web site environments are identical on XP,
    as Vista and the workbook and sheet definitely exist. As well, on Vista i am
    running under admin. The interesting thing is that the connection/cmd.state =
    1 (Open).

    "Mark Rae [MVP]" wrote:

    > "David" <> wrote in message
    > news:...
    >
    > > "The Microsoft Jet database engine could not find the object 'schedule$'.
    > > Make sure the object exists and that you spell its name and the path name
    > > correctly.".

    >
    > This is a common error and, regrettably, occurs for a myriad of reasons. The
    > main ones are that the workbook doesn't exist, the worksheet doesn't exist
    > in the workbook, or that the account under which ASP.NET is running does not
    > have sufficient permissions on the workbook.
    >
    > Without actually stepping through your code, it's almost impossible to know
    > what's happening in your particular case.
    >
    > However, have you worked your way through these...?
    > http://www.google.co.uk/search?sour...ind the object" "Make sure the object exists"
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    >
    >
     
    David, Jan 13, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roger Twomey
    Replies:
    1
    Views:
    12,681
    Roger Twomey
    Apr 27, 2004
  2. cmay
    Replies:
    0
    Views:
    893
  3. Replies:
    0
    Views:
    375
  4. CS ADNT
    Replies:
    1
    Views:
    1,215
    CS ADNT
    Oct 16, 2009
  5. Replies:
    1
    Views:
    149
    Sisyphus
    Apr 27, 2007
Loading...

Share This Page