mysql压缩修复数据库_压缩修复Access数据库
using JRO //引用 public void Compact(string mdbPath) { if (!File.Exists(mdbPath)) { throw new Exception(目標(biāo)數(shù)據(jù)庫不存在,無法壓縮!); } //臨時數(shù)據(jù)庫名稱 string temp = DateTime.Now.ToString(yyyyMMddHHmmss) .bak; //臨時數(shù)據(jù)庫地址(包含名稱
using JRO //引用
public void Compact(string mdbPath)
{
if (!File.Exists(mdbPath))
{
throw new Exception("目標(biāo)數(shù)據(jù)庫不存在,無法壓縮!");
}
//臨時數(shù)據(jù)庫名稱
string temp = DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak";
//臨時數(shù)據(jù)庫地址(包含名稱)
temp = mdbPath.Substring(0, mdbPath.LastIndexOf("\\")+1) + temp;
//臨時數(shù)據(jù)庫連接字符串
string temp2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+temp;
//原始數(shù)據(jù)庫連接字符串
string mdbPath2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbPath;
//壓縮Access數(shù)據(jù)庫工具類(.dll c:\C:\Program Files (x86)\Common Files\System\ado\msjro.dll)
JetEngineClass jt = new JetEngineClass();
jt.CompactDatabase(mdbPath2,temp2);
File.Copy(temp,mdbPath,true);
File.Delete(temp);
}
本文原創(chuàng)發(fā)布php中文網(wǎng),轉(zhuǎn)載請注明出處,感謝您的尊重!
總結(jié)
以上是生活随笔為你收集整理的mysql压缩修复数据库_压缩修复Access数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 球定位实景导航 iOS实用应用周排行
- 下一篇: Android 字体库的使用-引入外部字