excel 连接字符串的含义。

来源:互联网 发布:怎么买到淘宝客户信息 编辑:程序博客网 时间:2024/06/02 23:41
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/MyExcel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""" 
"HDR=Yes;" indicates that the first row contains columnnames, not data
"IMEX=1;" tells the driver to always read "intermixed" data columns as text. Note that this option might affect excel sheet write access negative.
TIP! SQL syntax: "Select * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.
TIP! Check out the [HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Jet/4.0/Engines/Excel] located registry REG_DWORD "TypeGuessRows". That's the key to not letting Excel use only the first 8 rows to guess the columns data type. Set this value to 0 to scan all rows. This might hurt performance.
Important note! The two double quota ("") in the string are escaped quotas (VB syntax), you may have to change this to your language specific escape syntax (ex. /") or maybe single quota (').