PC Review


Reply
Thread Tools Rate Thread

Can't read the first Field of an Excel Spreadsheet....

 
 
Stu Lock
Guest
Posts: n/a
 
      14th Sep 2004
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/--



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Excel 2002 XML Spreadsheet format be read by Excel 2007? William Liu Microsoft Excel Misc 1 17th Nov 2008 06:05 PM
How to read Excel spreadsheet embedded in another spreadsheet GH Microsoft VB .NET 3 6th Feb 2007 05:41 PM
Can Excel 97 read Excel 2003 simple spreadsheet? =?Utf-8?B?TVNmU3Rs?= Microsoft Excel Misc 3 21st Nov 2005 08:08 PM
Read Excel Spreadsheet Via VB.Net =?Utf-8?B?Sm9obkRlSG9wZTM=?= Microsoft Excel Programming 1 25th May 2005 07:51 PM
how to read excel spreadsheet into database (DB2) =?Utf-8?B?bWFpcmh0aW4gbydmZWFubmFn?= Microsoft Excel Programming 1 31st May 2004 02:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:06 PM.