Solved

Integer values missing when read from XLS file in ASP.NET?

Posted on 2008-10-28
2
341 Views
Last Modified: 2013-11-08
I'm trying to import an XLS file. All the data is going in fine with one exception. One of the columns has a combination of numbers and numbers separated by commas or &'s. For example, the column can contain a value of 6 in one row and 5&6 or 5,6 in another. How this data is stored isn't the issue as it's just for the purposes of being displayed.

The issue is that, any rows that contain JUST an integer, it is read by the reader as NULL, while others are read normally. Meaning, the row with 6 is read as null, while the row with 5&6 or 5,6 is read as is.

I have tried using different field/cell formats in the XLS as well with the same results.

I tried using SqlBulkCopy as well as using OLEDB and reading in the records. Even just dumping the data from the loop to the screen yields the fields as being null. It's driving me crazy and this is for a client. Any assistance is greatly appreciated. I will provide any code needed.
0
Comment
Question by:redheaded
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 22824785
I suspect this is the issue you are running up against: http://www.dailydoseofexcel.com/archives/2004/06/03/external-data-mixed-data-types/
Whether any of that is applicable to ASP I couldn't tell you though! ;)
0
 

Author Closing Comment

by:redheaded
ID: 31510816
This was the exact answer. I was missing IMEX=1 on my connection string. Thanks!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question