Excel数据连接字符串
2010-11-30 20:37
309 查看
真是郁闷,每次碰到Excel都需要找原来的源码,烦人,现在干脆记下了吧:
1. 只能查询
string excelconnstring = string.Format(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1};IMEX=1'",
Excelsource, "Yes");/* HDR=YES; 表示 带有表头,第一行作为字段名. IMEX=1 表示 把非字符型表格内容作为string来读取 */
//建立指向该Excel文件的数据库连接
OleDbConnection con = new OleDbConnection(excelconnstring);
2.既能添加也能查询
string excelconnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Excelsource + ";Extended Properties='Excel 8.0;'";
OleDbConnection excelconn = new OleDbConnection(excelconnstring);
3.操作Excel的不等于情况只能用'<>',不能用'!='
4.例:select distinct * from [Sheet1$]
"
1. 只能查询
string excelconnstring = string.Format(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1};IMEX=1'",
Excelsource, "Yes");/* HDR=YES; 表示 带有表头,第一行作为字段名. IMEX=1 表示 把非字符型表格内容作为string来读取 */
//建立指向该Excel文件的数据库连接
OleDbConnection con = new OleDbConnection(excelconnstring);
2.既能添加也能查询
string excelconnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Excelsource + ";Extended Properties='Excel 8.0;'";
OleDbConnection excelconn = new OleDbConnection(excelconnstring);
3.操作Excel的不等于情况只能用'<>',不能用'!='
4.例:select distinct * from [Sheet1$]
"
相关文章推荐
- 使用OLEDB读取不同版本Excel数据的连接字符串设置
- 使用OLEDB读取不同版本Excel数据的连接字符串设置
- 使用OLEDB读取不同版本Excel数据的连接字符串设置
- Excel 常用的2个宏(拆分单元格并自动填充数据、取满足条件的值连接成字符串)
- 使用OLEDB读取不同版本Excel数据的连接字符串设置
- C# 使用OLEDB读取不同版本Excel数据的连接字符串
- C#连接EXCEL和ACCESS字符串2003及2007版
- excel(WPS)连接字符串_______用于sql拼写
- Excel Service +DCL +连接外部数据
- Excel文件导入到SQL Server——2007 Office system 驱动程序:数据连接组件
- jxl 从excel导入数据到数据库中;java中jdbc连接数据库
- C#连接Excel的连接字符串
- 程序中读取Excel数据一般有两种连接方式:ODBC和OLEDB;
- asp.net 操作Excel 连接字符串
- Oracle 起步日记(4)——数据查询之去重、字符串连接、子查询
- HOW TO:打开“数据链接属性”对话框并返回连接字符串
- python脚本――生成EXCEL,连接数据库,并将指定数据写入EXCEL
- excel 公式 多个if 连接字符串
- ODBC与ORCLE的连接及并导出数据库数据到Excel
- 连接excel2003、2007以上版本的excel的方法,返回一个连接字符串