连接串范例

Provider=Microsoft.Jet.OLEDB.4.0;Data Source="D:\My Works\AN45S01283.xls";Persist Security Info=False;Extended Properties="Excel 8.0;HDR=YES;IMEX=1"

excel 2000 ~ 2003的 OleDb 连接串的格式如下:
Provider=Microsoft.Jet.OleDb.4.0;Data Source='excel文件路径';Extended Properties='Excel 8.0;HDR=YES'

excel 2007 的 OleDb 的连接串的格式如下:

Provider=Microsoft.Ace.OleDb.12.0;Data Source='excel文件路径';Extended Properties='Excel 12.0;HDR=YES'

Excel2000-2003:

OleDbConnection ExcelConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + FilePath + "; Extended Properties='Excel 12.0;HDR=YES;IMEX=1'");

Excel2007:
OleDbConnection ExcelConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + FilePath + "; Extended Properties='Excel 12.0 Xml;HDR=YES;IMEX=1'");

相关文章:

  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-11-19
  • 2022-01-23
  • 2022-02-09
  • 2022-01-18
  • 2023-02-15
猜你喜欢
  • 2021-12-16
  • 2021-10-20
  • 2022-01-07
  • 2021-12-29
  • 2021-05-30
  • 2021-06-15
相关资源
相似解决方案