Solved

Problem of mixed data types in reading excel file in asp.net using OLEDB

Posted on 2010-11-12
6
1,078 Views
Last Modified: 2012-08-14
Hello Everyone.

I have one problem if any one nows its solution please let me know.

I am reading one excel sheet in C#.net using OLEDB connection. While reading excel sheet if any column has mixed data type means both numeric and string provider return the data of the majority type, but return NULL (empty) values for the minority data type

For example:
In your eight (8) scanned rows, if the column contains five (5) numeric values and three (3) text values, the provider returns five (5) numbers and three (3) null values.
In your eight (8) scanned rows, if the column contains three (3) numeric values and five (5) text values, the provider returns three (3) null values and five (5) text values.
In your eight (8) scanned rows, if the column contains four (4) numeric values and four (4) text values, the provider returns four (4) numbers and four (4) null values.

can anyone tell me how can i get data of minority datatype.
0
Comment
Question by:jasbirbrar
6 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34118552
Format all the cells as text.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34118557
Then you can convert them to numbers later in your query if you need to.
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 34118586
0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 34128400
How exactly are you connecting to Excel and 'reading' the data?
0
 

Author Comment

by:jasbirbrar
ID: 34229084
a
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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‚Ķ

809 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