I want to bring data from certain cells in an Excel workbook into a datatable. The Excel is 97 - 2003 and is in \Box_zero.xls. The code snippet below gives an error "Could not find installable ISAM". From what I see in the literature, this error often means that there is an error in the connection string or thereabouts. I can NOT find the error. I expect it's glaringly obvious, but....
These are the namespaces
Imports System.Data
Imports System.Data.Common
Imports System.Data.OleDb
Imports System.Data.Odbc
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.IO
Imports System.Web
Imports System.Web.HttpResponse
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.HttpContext
The working snippet is :
'
' Create the connection string for the EXCEL file containing the filename and Provider settings.
'
Dim root As String
root = HttpContext.Current.Server.MapPath("BoxStore")
Dim filepath As String = root & "\" & "Box_zero.xls"
Dim connectionString As String = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=filepath;ExtendedProperties=""Excel 8.0;HDR=No;""" ' Version A
'
' Create a new connection object and open it for processing.
'
Dim objConn As OleDbConnection = New OleDbConnection(connectionString)
objConn.Open()