ADO连接EXCEL出现“run time error”是怎么回事 谢谢
“microsoft ”ODBC驱动程序管理器 未发现数据源名称并且未指定默认驱动程序
我应该怎样做呀

解决方案 »

  1.   

    连接字符错了,连接字符请参考这个站上:http://www.connectionstrings.com/ Excel 
     ODBC 
     Standard:"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;DefaultDir=c:\mypath;" 
    TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.
     OLE DB 
     Standard:"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
    TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.
      

  2.   

    "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\test.xls;Extended Properties='Excel 8.0;HDR=Yes'"
      

  3.   

    谁告诉你象他那样就成了?office分多个版本,驱动选择都是不一样的,别看4.0和3.5 9和8之间,错了就不行
    你最好拿个adodc控件先去连接生成连接字符串
      

  4.   

    用ADODC控件生成连接字符串时都没看到跟excel连的啊,提供程序要选哪个?
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\f\study\book1.xls;Extended Properties=""Excel 8.0;HDR=YES;IMEX=1""",我这样写,连接excel2003的可以
      

  5.   

    excel中要select是不是只能select * from [sheet1$],不然列名要选什么?怎么写?
      

  6.   

    "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\test.xls;Extended Properties='Excel 8.0;HDR=Yes'"
     8.0 改为9.0