用c#压缩ACCESS数据库文件有没有相应的控件?
网上压缩的方法:ICSharpCode.SharpZipLib.dll,不是压缩成winrar格式的吧?

解决方案 »

  1.   

    这个只提供一个压缩算法,与各种zip文件使用的算法应该是类似的。
      

  2.   

    这种方法对于我行吗?
    我想做的是压缩了之后发送到另一端,然后在另一端解压。
      static void CompactAccessDB(string connectionString, string mdwfilename)
            {
                object[] oParams;
                object objJRO = Activator.CreateInstance(Type.GetTypeFromProgID("JRO.JetEngine"));
                oParams = new object[] {connectionString,
                     "Provider=Microsoft.Jet.OLEDB.4.0;Data;Source=C:\\temp.mdb;Jet OLEDB:Engine Type=5"};           objJRO.GetType().InvokeMember("CompactDatabase",System.Reflection.BindingFlags.InvokeMethod,
                    null,objJRO,oParams);
                System.IO.File.Delete(mdwfilename);
                System.IO.File.Move("C:\\temp.mdb", mdwfilename);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(objJRO);
                objJRO = null;
            }
    如果不行,该用哪一种?希望大哥给提示一下。
      

  3.   

    芥子大哥,不好意思我没说清楚,你确认的是哪种?
    第一种:ICSharpCode.SharpZipLib.dll
    第二种:static void CompactAccessDB(string connectionString, string mdwfilename) 
            { 
                object[] oParams; 
                object objJRO = Activator.CreateInstance(Type.GetTypeFromProgID("JRO.JetEngine")); 
                oParams = new object[] {connectionString, 
                    "Provider=Microsoft.Jet.OLEDB.4.0;Data;Source=C:\\temp.mdb;Jet OLEDB:Engine Type=5"};          objJRO.GetType().InvokeMember("CompactDatabase",System.Reflection.BindingFlags.InvokeMethod, 
                    null,objJRO,oParams); 
                System.IO.File.Delete(mdwfilename); 
                System.IO.File.Move("C:\\temp.mdb", mdwfilename); 
                System.Runtime.InteropServices.Marshal.ReleaseComObject(objJRO); 
                objJRO = null; 
            } 
    如果是第一种,是不是要在网上下载个东西,如果是第二种应该能找到解压的方法哈。有没有更好的方法了?
      

  4.   

    你第二种方法我不了解是什么,但不管是哪一种,只要这边处理了发过去,然后对方接收了能把它还原,基本上就可以了。
    免费的里面,SharpZipLib还算好用的吧,官方网站上可以下载。