首页 > 数据库技术 > 详细

c# 通过 OLEDB连接Access,DBF。

时间:2017-04-25 11:22:24      阅读:308      评论:0      收藏:0      [点我收藏+]

64位程序需要下载 驱动 AccessDatabaseEngine_X64.exe 

32位程序需要下载 驱动 AccessDatabaseEngine.exe 

官方下载地址:https://www.microsoft.com/zh-cn/download/details.aspx?id=13255

 

要与安装的office版本一直

64位链接

    this.connstring = string.Format("Provider = Microsoft.ACE.OLEDB.12.0 ;Data Source ={0};Extended Properties=dBASE IV;", filePath);
    this.Connection = new OleDbConnection(connstring);

32位链接

    this.connstring = string.Format("Provider = Microsoft.Jet.OLEDB.4.0 ;Data Source ={0};Extended Properties=dBASE IV;", filePath);
    this.Connection = new OleDbConnection(connstring);

基本代码

     this.Connection = new OleDbConnection(connstring);    
     OleDbCommand dc = Connection.CreateCommand();
    Connection.Open();
     dc.CommandText = Sql;
     int count = dc.ExecuteNonQuery();
     Connection.Close();
     dc.Dispose();

 

c# 通过 OLEDB连接Access,DBF。

原文:http://www.cnblogs.com/AlanYN/p/6760874.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!