Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1340
  • Last Modified:

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.
0
jasbirbrar
Asked:
jasbirbrar
1 Solution
 
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
 
NorieData ProcessorCommented:
How exactly are you connecting to Excel and 'reading' the data?
0
 
jasbirbrarAuthor Commented:
a
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now