急!C#连接EXCEL 找不到可安装的 ISAM "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Path + ";Extended Properties = \"Excel 8.0;HDR=NO;IMEX=1 \" "; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是不是Path的问题? 我原来也遇到过 把MSDN上的那个复制过来 然后不知怎么就好了 呵呵 这是因为你连接的字符串有问题。string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+";Extended Properties='Excel 8.0;HDR=NO;IMEX=1; '";在"IMEX=1"后面还要加上一个";" string strCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D\\Excel.xls;Extended Properties=Excel 8.0;HDR=NO;IMEX=1;";这样都不行!! 纯C#代码的Excel读取器(不需要Office Excel Com组件)zxjing 著于2007-7-18 7:31:28一个纯C#代码编写的Excel文件读取器,可以读出在工作簿(workbook)中的所有Worksheet,所有WorkSheet中的单元,单元的内容(文本,数字,日期或错误),单元的格式(字体,对齐,线条类型,背景等)够读取文件中的图片,获取图象的大小,位置,数据和格式。 重装了office,就是open 不了 天啊,怎么办string strCon= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D\\Excel.xls;Extended Properties=Excel 8.0;HDR=NO;IMEX=1; "; 试了n多次,救命啊 将HDR=NO;IMEX=1去掉试一试吧 string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Path + ";Extended Properties = \"Excel 8.0;HDR=NO;IMEX=1;\"";这样试过了没? EXCEL 8.0;HDR=YES;IMEX=1需要引号把这部分扩起来,具体怎么加忘记了,我遇到过这种情况 string strExcelFileName = @""+ myPath +""; string strString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + strExcelFileName + ";Extended Properties = 'Excel 8.0;HDR=NO;IMEX=1 '";试试这个吧,我也调了挺久,运行成功了! http://www.connectionstrings.com/看上面这个网站,绝对权威! 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();我机器上这样是没问题的 http://blog.csdn.net/laoyingisme/archive/2007/12/28/1999020.aspxgood luck!! 谢谢,加了“HDR=YES; IMEX=1”,就可以导入了。 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(); 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();... C# 卸载 outLook 插件 BUTTON控件中如何插入HTML超链接 C# 有一些C++基础 想学C#望各位高手指点一下,那些书比较适合 如何实现软件界面? 调用存储过程问题,请高手帮忙~~~~~~谢谢 怎样比较两个文件的版本? .net 调试问题 好像C:\Inetpub\wwwroot下的工程名没有办法可以修改啊? 线程中变量释放问题,在线等 c# 怎么和arduino进行蓝牙通信 System.ArgumentException: 列“编 号”不属于表 tablename C# 打包程序!组件注册!急 .UP也有分!
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+";Extended Properties='Excel 8.0;HDR=NO;IMEX=1; '";
在"IMEX=1"后面还要加上一个";"
这样都不行!!
zxjing 著于2007-7-18 7:31:28
一个纯C#代码编写的Excel文件读取器,可以读出在工作簿(workbook)中的所有Worksheet,所有WorkSheet中的单元,单元的内容(文本,数字,日期或错误),单元的格式(字体,对齐,线条类型,背景等)够读取文件中的图片,获取图象的大小,位置,数据和格式。
string strCon= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D\\Excel.xls;Extended Properties=Excel 8.0;HDR=NO;IMEX=1; ";
试了n多次,救命啊
这样试过了没?
需要引号把这部分扩起来,具体怎么加忘记了,我遇到过这种情况
string strExcelFileName = @""+ myPath +"";
string strString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + strExcelFileName + ";Extended Properties = 'Excel 8.0;HDR=NO;IMEX=1 '";试试这个吧,我也调了挺久,运行成功了!
看上面这个网站,绝对权威!
+ _xlsPathName + ";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'"; objConn = new OleDbConnection(strConn);
objConn.Open();我机器上这样是没问题的
good luck!!
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();
// 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();
...