app.config文件中excel表的连接字符串 [英] Connection string for excel sheet in app.config file

查看:67
本文介绍了app.config文件中excel表的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用OLEDB连接将数据插入Excel工作表,但连接字符串需要在app.config文件中写入

i want to insert the data into excel sheet using OLEDB connection but the connection string need to write in app.config file

推荐答案

Excel 2007以后的连接字符串 -

Provider = Microsoft.ACE.OLEDB.12.0; Data Source = c:\ myFolder \ myExcel2007file.xlsx;

扩展属性=Excel 12.0 Xml; HDR = YES;




Excel 2003的连接字符串 -

Provider = Microsoft.ACE。 OLEDB.12.0;数据源= c:\ myFolder \ myOldExcelFile.xls;

扩展属性=Excel 8.0; HDR = YES;




HDR =是;表示第一行包含列名,而不是数据。 HDR =无;表示相反的情况。
Connection string for Excel 2007 onwards -
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES";


Connection String for Excel 2003 -
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myOldExcelFile.xls;
Extended Properties="Excel 8.0;HDR=YES";


"HDR=Yes;" indicates that the first row contains column names, not data. "HDR=No;" indicates the opposite.


这篇关于app.config文件中excel表的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆