Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: Importing from Excel
12-19-2010, 02:02 PM #1
- Join Date
- May 2009
- North west England
- Thanked 0 Times in 0 Posts
Importing from Excel
I want to bring data from certain cells in an Excel workbook into a datatable. The Excel is 97 - 2003 and is in \BoxStore. 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
ASP.NET Syntax (Toggle Plain Text)
' ' 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()