C# Protect newly created Access Catalog with workgroup file

90 views Asked by At

I'm trying to protect a Access database by using a workgroup file as user-security. The file must be in the same folder as the database and you must enter a user name and password to access the database. I read something about the parameter "System Database" in connectionString, but I'm not sure how to use it. The database is created like this:

String accessConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + filepath";

using (OleDbConnection accessConnection = new OleDbConnection(accessConnectionString))
{
  ADOX.Catalog cat = new ADOX.Catalog();
  cat.ActiveConnection.Close();
  var newCreatedCatalog= cat.Create(accessConnectionString);
  OleDbCommand oleCommand = new OleDbCommand();
  // fill database
}
0

There are 0 answers