您的位置:   主页 > 成功案例

access数据库修复恢复(seo文章)

时间:2011-05-14 11:50来源:青岛数据恢复 作者:青岛四通数据恢复 点击:125次
青岛数据恢复 href="http://www.raidst.com">青岛数据恢复atSConnectionString.PassWord][STempFileName.;


标签:

it

分类:心得 unitUA ccessOperate;

interface

usWindows.ComObj,Sysutils.Dialogs,A ctiveX;

//改削ACCESS数据库密码

functionChangeDatabasePasswordA FileName.A NewPassWord:str:booleanA OldPassWord.;

覆盖源文件//耽误与修复数据库.

A PassWord:str:booleanfunctionCompactDatabasA FileName.;

如果文件存在则失败//建立Access文件。

functionCreateA ccessFilFileName:String;PassWord:string='':boolean;

implementation

//声名连接字符串

Const

SConnectionString    ='Provider=Microsoft.Jet.OLEDB.4.0;DataSource=%s;'

                    +'JetOLEDB:DatabasPassword=%s;';

//==青岛数据复原 href="http://www.raidst.com">青岛数据复原===========================================================================

//Procedure:GetTempPathFileName

//A uthor  :ysai

//Date    :2003-01-27

//A rguments:None

//Result  :string

//=============================================================================

functGetTempPathFileNam:string;

//获得权且文件名

var

SFile:arrai[0..254]ofcharSPath.;

begin

SPathGetTempPath254.;

GetTempFileNamSPath.0,'~SM'.SFil;

result:=SFile;

DeleteFilPCharresult;

end;

//=============================================================================

//Procedure:CreateA ccessFile

//A uthor  :ysai

//Date    :2003-01-27

//A rguments:FileName:String;PassWord:string=''

//Result  :boolean

//=============================================================================

如果文件存在则失败//建立Access文件。

functionCreateA ccessFilFileName:String;PassWord:string='':boolean;

var

STempFileName:string;

vCatalog:OleVariant;

begin

STempFileName:=GetTempPathFileName;

try

  vCatalog:=CreateOleObject'A DOX.Catalog';

  vCatalog.Crform

  result:=CopyFilPCharSTempFileNam.TruePCharFileNam.;

  DeleteFilSTempFileNam;

except

  result:=false;

end;

end;

//=============================================================================

//Procedure:CompactDatabase

//A uthor  :ysai

//Date    :2003-01-27

A PassWord:strin//A rguments:A FileName.g

//Result  :boolean

//=============================================================================

A PassWord:str:booleanfunctCompactDatabasA FileName.;

覆盖源文件//耽误与修复数据库.

var

STempFileName:string;

vJE:OleVariant;

begin

STempFileName:=GetTempPathFileName;

try

  vJE:=CreateOleObject'JRO.JetEngine';

  vJE.CompactDatabasformatSConnectionString.A PassWord],[A FileName.

    formatSConnectionString.A PassWord][STempFileName.;

  result:=CopyFilPCharSTempFileNam.falsPCharA FileNam.;

  DeleteFilSTempFileNam;

except

  result:=false;

end;

end;

//=============================================================================

//Procedure:ChangeDatabasePassword

//A uthor  :ysai

//Date    :2003-01-27

//A rguments:A FileName.A NewPassWord:strinA OldPassWord.g

//Result  :boolean

//=============================================================================

//改削ACCESS数据库密码

functionChangeDatabasePasswordA FileName.A NewPassWord:str:booleanA OldPassWord.;

var

  STempFileName:string;

  vJE:OleVariant;

begin

STempFileName:=GetTempPathFileName;

try

  vJE:=CreateOleObject'JRO.JetEngine';

  vJE.CompactDatabasformatSConnectionString.A OldPassWord],[A FileName.

                formatSConnectionString.A NewPassWord][STempFileName.;

  result:=CopyFilPCharSTempFileNam.falsPCharA FileNam.;

  DeleteFilSTempFileNam;

except

  result:=false;

end;

耽误与修复, <耽误与修复.Delphi改削Access密码.建立Access数据库文件

 

2011-05-0715:14:15 转载