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

推荐订阅源

S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
P
Palo Alto Networks Blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Tenable Blog
F
Full Disclosure
TaoSecurity Blog
TaoSecurity Blog
I
InfoQ
AI
AI
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
Microsoft Azure Blog
Microsoft Azure Blog
S
SegmentFault 最新的问题
Y
Y Combinator Blog
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
I
Intezer
L
Lohrmann on Cybersecurity
博客园_首页
量子位
Blog — PlanetScale
Blog — PlanetScale
The Last Watchdog
The Last Watchdog
Cisco Talos Blog
Cisco Talos Blog
博客园 - 叶小钗
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Help Net Security
Help Net Security
Security Archives - TechRepublic
Security Archives - TechRepublic
Apple Machine Learning Research
Apple Machine Learning Research
W
WeLiveSecurity
N
News and Events Feed by Topic
S
Schneier on Security
T
Tor Project blog
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
T
Threat Research - Cisco Blogs
H
Help Net Security
V
V2EX
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security @ Cisco Blogs
博客园 - Franky
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler

博客园 - leon qian

正则表达式全部符号解释 android显示大图片的一些技巧 SAPI 5.1 语音合成的事件 SAPI 5.1 语音合成的列举语音引擎 Unicode符号代码表 c#中的问号 C#的四则运算函数 - leon qian - 博客园 让CSS区别不同浏览器 在Repeater中使用按钮或其他控件的解决方法 - leon qian - 博客园 在IIS中使用Gzip压缩后传送数据 一堆常用JS代码 stream转string,string转stream 一个XML转换的例子 JS代码整理 asp.net 真正意义上的裁减图片 由于启动用户实例的进程时出错的解决方法 C#中的正则表达式 转 SqlHelper详解(转载) [转].net用url重写URLReWriter实现任意二级域名
读取Excel文件时出现null的解决方法 - leon qian - 博客园
leon qian · 2008-08-17 · via 博客园 - leon qian

在以往读取Excel文件时常常出现读取某些字段为null值,其实是有值,原因是读取文件时,Excel会以第一行的数据类型为参考,如果后边的与其不一致,则会出现些问题。
以下一个朋友的解决方案,他的Excel文件的连接串写作如下。据说可以强制数据为字符串,具体我没有再测试。仅供参考。
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sPath + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
其中红色的部分比较值得注意,HDR和IMEX一定要配合使用,HDR表示要把第一行作为数据还作为列名,作为数据用hdr=no,作为列名用hdr=yes;通过Imex=1来把混合型作为文本型读取,避免null值。SSIS中的Excel Connection和其他的Connection不一样,用户不需要指定数据类型,Excel的driver可以先去做一个采样,然后根据结果去猜一下数据类型。