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()

OK - I am sure you are correct. What I want you to tell me, please, is WHY it is invalid.

The connection string appears to be in the exact form that is specified by Microsoft. I have tried a number of slightly different versions that I have seen in the various discussion groups. I looked at the link you supplied and put OLEDB; in front of "Provider=......". Not only do none of these work, but I can't induce the system to yield up further clues ..... ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.