压缩Access数据库的问题(C#)
用程序压缩Access数据库,用的方法是:
object[] oParams;
//create an inctance of a Jet Replication Object
object objJRO = Activator.CreateInstance(Type.GetTypeFromProgID( "JRO.JetEngine "));
//filling Parameters array
//cnahge "Jet OLEDB:Engine Type=5 " to an appropriate value
// or leave it as is if you db is JET4X format (access 2000,2002)
//(yes, jetengine5 is for JET4X, no misprint here)
oParams = new object[] {
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + mdwfilename,
"Provider=Microsoft.Jet.OLEDB.4.0;Data " +
" Source=C:\\tempdb.mdb;Jet OLEDB:Engine Type=5 "};
//invoke a CompactDatabase method of a JRO object
//pass Parameters array
objJRO.GetType().InvokeMember( "CompactDatabase ",
System.Reflection.BindingFlags.InvokeMethod,
null,
objJRO,
oParams);
//database is compacted now
&nb