用ODBC或OLEDB连接Excel:
1、ODBC 
Standard:
"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;DefaultDir=c:\mypath;" 2、 OLE DB
 Standard:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties=Excel 8.0;HDR=Yes;""HDR=Yes;" indicates that the first row contains columnnames, not data DBF / FoxPro  ODBC

解决方案 »

  1.   

    可是我现在的程序还报错啊,而且我用的是 office2003
      

  2.   

    string database = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties=Excel 8.0"; 
    OleDbConnection oleConn = new OleDbConnection(database); 这个也是Office 2003的,我用得很正常
      

  3.   

    cnnstring="Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = "+mDataBaseName+";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
    Olecnn.ConnectionString=cnnstring;
    Olecnn.Open();
    用这个试试看
      

  4.   

    我刚刚解决了这个问题:
    System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection(@"provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book2.xls;Extended Properties=Excel 8.0;");
    con.Open();