Solved

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

Posted on 2010-11-12
6
1,103 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

789 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