Solved

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

Posted on 2008-10-28
2
339 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

816 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now