Using Visual Studio 2010 with a C# WPF project. I know how to create an Access 2000-2003 db file using the ADOX namespace.
ADOX.CatalogClass cat = new CatalogClass();
string str = "provider=Microsoft.Jet.OleDb.4.0;Data Source=" + _dbPath + ";";
cat.Create(str);
cat = null;
Connect and open the database:
conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ _dbPath + ";");
//connect to it with a password
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _dbPath + ";User Id=admin;Password=myPassword;"
I want to create the file password protected:
ADOX.CatalogClass cat = new CatalogClass();
string str = "provider=Microsoft.Jet.OleDb.4.0;Data Source="
+ _dbPath + ";Password=myPassword;";
cat.Create(str);
cat = null;
This produces an error at runtime:
Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
When I create without the password, the database is created successfully.
How can I create a password protected Access database with this strategy?