Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

707 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