Solved

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

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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…
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…

747 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

10 Experts available now in Live!

Get 1:1 Help Now