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

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.
jasbirbrarAsked:
Who is Participating?
 
NorieConnect With a Mentor VBA ExpertCommented:
How exactly are you connecting to Excel and 'reading' the data?
0
 
TommySzalapskiCommented:
Format all the cells as text.
0
 
TommySzalapskiCommented:
Then you can convert them to numbers later in your query if you need to.
0
 
jasbirbrarAuthor Commented:
a
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.