EXCEL Reading Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ahmd

    EXCEL Reading Error

    Error: - the process cannot access the file. XXXXX.xls becuase it is
    being used by another process.

    I used OLE DB for opening EXCEL File ; -
    ' Connect to the Excel Spreadsheet
    Dim xConnStr As String = "Provider=Micro soft.Jet.OLEDB. 4.0;" &
    _
    "Data Source=" & Server.MapPath( "~/
    ExcelImportPayO ut.xls") & ";" & _
    "Extended Properties=Exce l 8.0;"

    ' create your excel connection object using the connection
    string
    Dim objXConn As New Data.OleDb.OleD bConnection(xCo nnStr)
    objXConn.Open()

    ' use a SQL Select command to retrieve the data from the Excel
    Spreadsheet
    ' the "table name" is the name of the worksheet within the
    spreadsheet
    ' in this case, the worksheet name is "Members" and is coded
    as: [Members$]
    Dim objCommand As New Data.OleDb.OleD bCommand("SELEC T * FROM
    [Sheet1$]", objXConn)
    Return objCommand
    Pls Help
  • Mark Rae [MVP]

    #2
    Re: EXCEL Reading Error

    "Ahmd" <mkahmed77@gmai l.comwrote in message
    news:3f7073cd-ca22-4ffb-b5d6-69afb816a0b1@l6 4g2000hse.googl egroups.com...
    Error: - the process cannot access the file. XXXXX.xls becuase it is
    being used by another process.
    That almost certainly means exactly what it says i.e. that the Excel
    workbook is already open...


    --
    Mark Rae
    ASP.NET MVP


    Comment

    Working...