setting Access in C#

  • Thread starter Thread starter John K
  • Start date Start date
J

John K

ok,
I'm lost at how to try this.... any pointers on
how to set the password of an access DB within C#?

this is what I tried:

string strDestDB2 = "NewMdb.mdb";
string strSourceConnect2 = "Data Source=" + strDestDB;
string strDestConnect2 = "Data Source=" + strDestDB2
+ ";Jet OLEDB:Password="+SAPassword;
jetEngine.CompactDatabase(strSourceConnect2,
strDestConnect2);

John
 
Hi John,

Here you go
@"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet
OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=YOURPASSWORD;Data
Source=""DATABASE"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System
database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet
OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False"



If you are using password set on database you should set OLEDB:Database
Password (and not Password) connection string property.
 
¤ ok,
¤ I'm lost at how to try this.... any pointers on
¤ how to set the password of an access DB within C#?
¤
¤ this is what I tried:
¤
¤ string strDestDB2 = "NewMdb.mdb";
¤ string strSourceConnect2 = "Data Source=" + strDestDB;
¤ string strDestConnect2 = "Data Source=" + strDestDB2
¤ + ";Jet OLEDB:Password="+SAPassword;
¤ jetEngine.CompactDatabase(strSourceConnect2,
¤ strDestConnect2);

If you want to set or change the password for an Access database you can use DDL (with Jet 4.0). See
the following example:

http://support.microsoft.com/default.aspx?scid=kb;en-us;304915


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top