Here's the code i'm using. I got it from a C# example at:
http://weblogs.asp.net/donxml/archiv.../21/24908.aspx
The Excel file i'm reading from has a single worksheet called "orders".
Whenever I run the code below, it returns zero rows in the Schema Table.
I need help! Thanks.
Dim ExcelConnectionStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
ExcelFile & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
Dim ExcelConnection As New _
OleDbConnection(ExcelConnectionStr)
Dim ExcelCommand = New OleDbCommand
ExcelCommand.connection = ExcelConnection
Dim ExcelAdapter As New OleDbDataAdapter(ExcelCommand)
ExcelConnection.Open()
Dim ExcelSheets As DataTable = _
ExcelConnection.GetOleDbSchemaTable
(OleDbSchemaGuid.Tables, _
New Object() {Nothing, Nothing, Nothing, "TABLE"})
MsgBox(ExcelSheets.Rows.Count)
For i As Integer = 0 To ExcelSheets.Rows.Count - 1
MsgBox(ExcelSheets.Rows(i).Item("TABLE_NAME"))
Next
ExcelConnection.Close()
*** Sent via Developersdex
http://www.developersdex.com ***