Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-28
2
Medium Priority
?
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

715 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