用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、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
解决方案 »
- |ZYCWPF| Interaction的ConditionBehavior在EventTrigger有效,但在DataTrigger为什么无效,谢谢有示例
- winform 中下载exe文件报错
- listview小问题
- 在C#如何制作皮肤
- $$$ public event MyDelegate OnOccurUseDelegate; 这行的event有什么用?
- C#开发你在单位里配套什么操作系统?
- 有人知道 可以不可以实现QQ群发的功能(C#)
- 动态创建的多选框 如何获得多选框的实例
- C#解密和加密一个文件!
- 第一次写面向对象的东东,兄弟姐妹们帮我看看怎么规划这些类!!!
- 性能计数器被禁用了?在线等
- 怎么在二进位字符串和十六进位字符串间转换??
OleDbConnection oleConn = new OleDbConnection(database); 这个也是Office 2003的,我用得很正常
Olecnn.ConnectionString=cnnstring;
Olecnn.Open();
用这个试试看
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();