EXCEL Reading Error

A

Ahmd

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=Microsoft.Jet.OLEDB.4.0;" &
_
"Data Source=" & Server.MapPath("~/
ExcelImportPayOut.xls") & ";" & _
"Extended Properties=Excel 8.0;"

' create your excel connection object using the connection
string
Dim objXConn As New Data.OleDb.OleDbConnection(xConnStr)
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.OleDbCommand("SELECT * FROM
[Sheet1$]", objXConn)
Return objCommand
Pls Help
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top