Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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 use a scrolling table in Microsoft Excel using the INDEX function.

911 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

24 Experts available now in Live!

Get 1:1 Help Now