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();
时间: 2024-11-10 08:08:50