function CreateAccessFile(FileName: string; PassWord: string = ''): boolean;
const
SConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Jet OLEDB:Database Password=%s;';
var
vCatalog: OleVariant;
begin
try
    vCatalog := CreateOleObject('ADOX.Catalog');
    vCatalog.Create(format(SConnectionString, [FileName, PassWord]));
    Result := True;
except
    Result := False;
end;
end;
posted on 2010-12-18 00:40  fyen  阅读(350)  评论(0编辑  收藏  举报