office - 连接字符串.

Microsoft ACE OLEDB 12.0

Connect to Excel 2007 (and later) files with the Xlsx file extension. That is the Office Open XML format with macros disabled.

例如(虽然是07和以后版本,但我无意中发觉,它也是向上兼容v2003的):

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;

Extended Properties="Excel 12.0 Xml;HDR=YES";

 "HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

参见:  http://www.connectionstrings.com/excel/

 

Normal ConnectionString : (work for xls files)

Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES;\""

ref: Working with MS Excel(xls / xlsx) Using MDAC and

 

你可能感兴趣的:(Office)