Excel Data Types

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm trying to read data from Excel using a DataReader. It works pretty well, except in one situation. That situation has my numeric data starting approximately in row 10 (it can vary). Above row 10, are dates and text strings relating to the numeric data that I need. The rows that they're in also can vary.

When I try to read the data, the DataReader picks up on the fact that my columns are numeric (double). The rows with the dates and text seem to come up as Null.
Is there any way I can read these text and date values? Perhaps by reading everything, as a string and then casting them into what I want?

I'd appreciate any help.

Thanks,

Art
 
¤ Hi,
¤
¤ I'm trying to read data from Excel using a DataReader. It works pretty well, except in one situation. That situation has my numeric data starting approximately in row 10 (it can vary). Above row 10, are dates and text strings relating to the numeric data that I need. The rows that they're in also can vary.
¤
¤ When I try to read the data, the DataReader picks up on the fact that my columns are numeric (double). The rows with the dates and text seem to come up as Null.
¤ Is there any way I can read these text and date values? Perhaps by reading everything, as a string and then casting them into what I want?
¤

If you're using mixed mode data types then you need to specify the IMEX argument:

ExcelConn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\myData.XLS;Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;""")


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top