"Provider=Microsoft.Jet.OLEDB.4.0;Data   Source   =   "   +   Path   +   ";Extended   Properties   = \"Excel   8.0;HDR=NO;IMEX=1 \
" "; 

解决方案 »

  1.   

    是不是Path的问题? 我原来也遇到过 把MSDN上的那个复制过来 然后不知怎么就好了 呵呵
      

  2.   

    这是因为你连接的字符串有问题。
    string   strConnection   =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+";Extended Properties='Excel 8.0;HDR=NO;IMEX=1; '";
    在"IMEX=1"后面还要加上一个";"
      

  3.   

    string strCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D\\Excel.xls;Extended Properties=Excel 8.0;HDR=NO;IMEX=1;";
    这样都不行!!
      

  4.   

    纯C#代码的Excel读取器(不需要Office Excel Com组件)
    zxjing 著于2007-7-18 7:31:28
    一个纯C#代码编写的Excel文件读取器,可以读出在工作簿(workbook)中的所有Worksheet,所有WorkSheet中的单元,单元的内容(文本,数字,日期或错误),单元的格式(字体,对齐,线条类型,背景等)够读取文件中的图片,获取图象的大小,位置,数据和格式。
      

  5.   

    重装了office,就是open 不了
      

  6.   

    天啊,怎么办
    string   strCon= "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source=D\\Excel.xls;Extended   Properties=Excel   8.0;HDR=NO;IMEX=1; "; 
    试了n多次,救命啊
      

  7.   

    将HDR=NO;IMEX=1去掉试一试吧
      

  8.   

    string   strCon   =   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source   =   "   +   Path   +   ";Extended   Properties   = \"Excel   8.0;HDR=NO;IMEX=1;\"";
    这样试过了没?
      

  9.   

    EXCEL 8.0;HDR=YES;IMEX=1
    需要引号把这部分扩起来,具体怎么加忘记了,我遇到过这种情况
      

  10.   


    string strExcelFileName = @""+ myPath +"";
                        string strString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + strExcelFileName + ";Extended Properties = 'Excel 8.0;HDR=NO;IMEX=1 '";试试这个吧,我也调了挺久,运行成功了!
      

  11.   

    http://www.connectionstrings.com/
    看上面这个网站,绝对权威!
      

  12.   

    string strConn = "Provider=Microsoft.Jet.OleDb.4.0;" + "data source="
                        + _xlsPathName + ";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";                objConn = new OleDbConnection(strConn);
                    objConn.Open();我机器上这样是没问题的
      

  13.   

    http://blog.csdn.net/laoyingisme/archive/2007/12/28/1999020.aspx
    good luck!!
      

  14.   

    谢谢,加了“HDR=YES; IMEX=1”,就可以导入了。
      

  15.   

    excel 2007
      oleDbConnExcel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Jet OLEDB:Database Password=;Extended properties=Excel 12.0;Data Source=" + System.IO.Directory.GetCurrentDirectory() + "\\FF_Sales_082zhengda(1).xlsx");
                    // oleDbConnExcel = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=;Extended properties=Excel 5.0;Data Source=E:\\FF_Sales_082zhengda(1).xls");
                    oleDbConnExcel.Open();
                    strGetDataFromExcel = "SELECT * FROM [Sheet1$A11:G]";   //从有效行开始取值
                    oleDbCmdExcel = new OleDbCommand(strGetDataFromExcel, oleDbConnExcel);
                    oleDbDataReaderExcel = oleDbCmdExcel.ExecuteReader();
      

  16.   

                    oleDbConnExcel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Jet OLEDB:Database Password=;Extended properties=Excel 12.0;Data Source=" + System.IO.Directory.GetCurrentDirectory() + "\\FF_Sales_082zhengda(1).xlsx");
                    // oleDbConnExcel = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=;Extended properties=Excel 5.0;Data Source=E:\\FF_Sales_082zhengda(1).xls");
                    oleDbConnExcel.Open();
                    strGetDataFromExcel = "SELECT * FROM [Sheet1$A11:G]";   //从有效行开始取值
                    oleDbCmdExcel = new OleDbCommand(strGetDataFromExcel, oleDbConnExcel);
                    oleDbDataReaderExcel = oleDbCmdExcel.ExecuteReader();
    ...