Solved

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

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

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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 a scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

615 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