您的位置:首页 > 其它

[转载]A problem when reading data from Excel

2009-11-01 21:33 465 查看

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*:

[b]Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/TypeGuessRows Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/ImportMixedTypes

[/b]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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐