惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - Boy Xie

sql xpath 收藏 HTTP 错误 sql2008 备份 javascript小收藏 转载 收藏sharepoint修改该服务器机器名 5月12日 日志 2010年5月11日日志 公司居然使用监听设备,大家来讨论下IT公司应该怎样管理 历史人物谈股市 常考的js笔试语句 - Boy Xie - 博客园 dns服务器列表 EXTJS 双层表头 记录 常用js收藏 页面宽度 SQL中取得时间的一些技巧 loadfrom 与 loadfile 区别 使用深度V8.1 系统后打开部分文件夹缓慢 判断客户端是否安装framework ascII 表 收藏
C# 读取excel - Boy Xie
Boy Xie · 2009-12-11 · via 博客园 - Boy Xie

无法读取Excel中的数据单元格。有数据,但是读出来全是空值。

C#读取Excel遇到无法读取的解决方法:

1.在导入数据连接字符串中,将IMEX=1加入,“Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\Data.xls";Extended Properties="Excel 8.0;HDR=Yes;IMEX=1; ”,这样就可以。

C#读取Excel需要注意的:

IMEX=1:混合模式

HDR=Yes; 是否让第一行作为列头

两者必须一起使用。

本以为这样就OK了。但在实际使用过程中,这样设置还是不行,查阅了不少资料才发现,原来还有一个注册表里的信息需要修改,这样带能让excel不再使用前8行的内容来确定该列的类型。

C#读取Excel之注册表修改内容如下:

在HKLM\Software\Microsoft\Jet\4.0\Engines\Excel有一个TypeGuessRows值,预设是8,表示会先读取前8列来决定每一个栏位的型态,所以如果前8列的资料都是数字,到了第9列以后出现的文字资料都会变成null,所以如果要解决这个问题,只要把TypeGuessRows机码值改成0,就可以解这个问题了!