无法读取Excel文件在C#中的数值 [英] unable to read numeric values from excel file in c#

查看:222
本文介绍了无法读取Excel文件在C#中的数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的ConnectionString

i am using the following connectionstring

提供商= Microsoft.Jet.OLEDB.4.0;+
数据源=+ Convert.ToString(PA)
+,+扩展属性= Excel的8.0

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

推荐答案

阅读这篇博客

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

更好地了解这里发生了什么。为了使短:使用OleDb的读取Excel表是(糟糕!)的设计非常不可靠。这里是一个更好的选择(旧非XML的Excel文件格式):

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/

(下文件部分,你会发现这个Java库的C#端口)

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

这篇关于无法读取Excel文件在C#中的数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆