Hi,
I am using the code below to read an Excel spreadsheet and process the data.
Unfortunately it just misses off the first field. It appears the first field
was added from another spreadsheet after all the others. Can anyone suggest
what it is that is stopping the driver from accessing the first column? Is
it a formatting problem? Is there a 'hide column from the jet driver' button
in Excel.....?
Many thaks in advance.
Stu
FYI: I am using:
VS2003,Framework 1.1 SP1, ASP.Net, Jet Engine SP8 (Blimey!)
And it took me 2 hours to find out it was a formatting problem....grrrrr.
--/snip/--
Dim dr As SqlDataReader
Dim cnExcel As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\MyFile.xls;Extended Properties=Excel 8.0;")
cnExcel.Open()
Dim lookup As DataTable
lookup = cnExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
Dim cmdExcel As New OleDbCommand("SELECT * FROM [" &
lookup.Rows(0)("TABLE_NAME") & "]", cnExcel)
Dim drExcel As OleDbDataReader
drExcel = cmdExcel.ExecuteReader
Do While drExcel.Read = True
'Do stuff
Loop
drExcel.close
cnExcel.Close
cnExcel.Dispose
--/snip/--
|