0

i am using the following connectionstring

Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Convert.ToString(pa) + ";" + "Extended Properties=Excel 8.0

but when a column contains only numeric value it reads it as empty

any idea? kindly help

2
  • 2
    does your excel column contain only numeric values or does it also include string values? If there is a header for the columns then you have to use HDR=1; option in the connection string. Commented Mar 2, 2011 at 13:12
  • @Devendra: it may include string and numeric values as well,Headers are not mandatory.. but while reading i get the 1st row as header row.but if i set HDR=1 then always 1st row will be treated as header.if 1st row is empty then 2nd row will be treated as header,but y the numeric values are not read? Commented Mar 2, 2011 at 17:20

1 Answer 1

0

Read this blog post

http://blog.lab49.com/archives/196

to understand better what is happening here. To make it short: using OleDb to read Excel sheets is very unreliable by (bad!) design. Here is a much better alternative (for the old non-XML Excel file format):

http://jexcelapi.sourceforge.net/

(under the Files section you will find a C# port of this Java library).

Sign up to request clarification or add additional context in comments.

1 Comment

thanx brown excelent article on blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.