汇聚万千丝和绪,记录点滴得与失.

-关注移动互联网、软件开发过程与质量、数据库 -开源轻量级项目管理软件实践者(Trac+Subversion+Testlink+Reviewboard+Hudson+...)

[zz]A problem when reading data from Excel

  阅读: 81 评论: 0 作者: 布鲁斯南 发表于 2008-10-13 10:03 原文链接

Read data from one column, Excel will check first 8 rows (Default Value)'s format. If first 8 rows are number, and row 9 is string, the string value will missing.

1. Add "IMEX=1" to connection string. 2. Change the key value in register.

Details: Check the following registry settings for the *machine*:

Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/TypeGuessRows Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/ImportMixedTypes

TypeGuessRows: setting the value to 0 (zero) will force ADO to scan all column values before choosing the appropriate data type.

ImportMixedTypes: should be set to value 'Text' i.e. import mixed-type columns as text:

Using IMEX=1 in the connection string (as you have done) ensures the registry setting is applied.

  发表评论


新闻频道:虾米网:游弋音乐分享界

推荐链接:Windows 7专题发布

网站导航:博客园首页  个人主页  新闻  社区  博问  闪存  知识库

posted on 2008-10-13 10:03  brucenan  阅读(104)  评论(0)    收藏  举报

导航