Delphi Resident Access Database

xiaoxiao2021-03-05  49

uses dao97, dao2000; procedure CompactMdbDatabase (srcDbname, dstDbname, oldpwd, newpwd: string; bAccess97: boolean = true); var idbEngine: _dbEngine; begin if oldpwd <> '' then oldpwd: = '; pwd =' oldpwd; if newpwd <> '' then newpwd: = '; pwd =' newpwd; if bAccess97 then begin idbengine: = CreateComObject (dao97.CLASS_DBEngine) as _DBEngine; idbEngine.CompactDatabase (srcDbname, dstDbname, newpwd, dbVersion30, oldpwd); end else begin idbengine: = CreateComObject (dao2000.CLASS_DBEngine) as _DBEngine; idbEngine.CompactDatabase (srcDbname, dstDbname, newpwd, dbVersion40, oldpwd); end; end; above that circulated on the internet has long been a compression method; it is a third-party call The components are completed, according to some ASP information, write the following method! This is done through the COM component provided by MS, and there is a requirement for the system, only the NT core system provides some components, non- NT needs to be installed! Var myObject: variant; olddata, newdata: string; begin myObject: = CreateoleObject ('jro.jetengine'); OldData: = 'provider = microsoft.jet.Oledb.4.0; data source =' 'd: /test1.mdb'; newdata: = 'provider = microsoft.jet.Oledb.4.0; data source =' 'd: /test2.mdb'; MyObject.compactDatabase (OldData, NewData); END; of course, This COM component is also mentioned For other functions, you can get its other features by analyzing its DLL!

转载请注明原文地址:https://www.9cbs.com/read-31768.html

New Post(0)