如何使用C#压缩MSACCESS数据库 [英] how to compact Msaccess database using c#
本文介绍了如何使用C#压缩MSACCESS数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是有可能使用C#压缩MSACCESS数据库,如果是的话让我知道的方法是什么?
is it possible to compact the Msaccess database using c# if so let me know the way?
推荐答案
您可以试一下像这样
public static void CompactAndRepair(string accessFile, Microsoft.Office.Interop.Access.Application app)
{
string tempFile = Path.Combine(Path.GetDirectoryName(accessFile),
Path.GetRandomFileName() + Path.GetExtension(accessFile));
app.CompactRepair(accessFile, tempFile, false);
app.Visible = false;
FileInfo temp = new FileInfo(tempFile);
temp.CopyTo(accessFile, true);
temp.Delete();
}
又见的使用Application对象紧凑的CompactRepair方法和修复数据库
这篇关于如何使用C#压缩MSACCESS数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文