Re: Assign username/password to access file
- From: "Mikael Lenfors" <mikael@xxxxxxxxxx>
- Date: Tue, 9 Oct 2007 15:10:03 +0200
Ok thanks! I'll try this.
"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message
news:s1plg3150sduc6b8rr8abn52j4l32lkjqf@xxxxxxxxxx
Hello!
If I want to assign a username and a password to an existing accessfile,
how
do I do this? Please code sample....
Your question isn't accurately phrased.
Access has two types of passwords. There is a database password the
applies to
the Access datbase file. I assume this is what you mean by access file
but
there is no user name associated with this password.
There are also use level security you can set for different objects that
does
have a user and password.
Neither of these can be set with ADO.
You can set a database password by importing the JRO type library and
using code
like this
uses JRO_TLB;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
engine: IJetEngine;
src, dst, path: WideString;
begin
path := ExtractFilePath(ParamStr(0));
//src is connection string to existing database with old password
src := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + path + 'test.mdb'
+
';Jet OLEDB:Database Password=oldpassword';
//dst is connection string to compacted db with new password
dst := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + path +
'compacted.mdb' +
';Jet OLEDB:Database Password=newpassword';
engine := CoJetEngine.Create();
engine.CompactDatabase(src, dst);
end;
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- References:
- Assign username/password to access file
- From: Mikael Lenfors
- Re: Assign username/password to access file
- From: Brian Bushay TeamB
- Assign username/password to access file
- Prev by Date: Re: TADOStoredProc
- Next by Date: Re: Assign username/password to access file
- Previous by thread: Re: Assign username/password to access file
- Next by thread: Re: Assign username/password to access file
- Index(es):