Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, December 21, 2009 5:36 AM
I have successfuly created access databases but is there something I can place in the code to have the database created have a password added to it?
try
{
Catalog cat = new Catalog();
string strCreateDB = "";
strCreateDB += "Provider=Microsoft.Jet.OLEDB.4.0;";
strCreateDB += "Data Source=" + pstrDB + ";";
strCreateDB += "Jet OLEDB:Engine Type=5";
cat.Create(strCreateDB);
}//closes try.
catch (Exception)
{
}//closes catch.
All replies (6)
Wednesday, December 23, 2009 11:53 AM ✅Answered | 1 vote
Hello, Rick
There are four types of connectstring, User ID=myUsername; is for a workGroup that specify a userName and password, and you must specify a database file for it. like, Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:System Database=system.mdw;User ID=myUsername;Password=myPassword, your doesn't do this, so you caught the exception.
If you don't need work group, for standard security with password, you just need to build a connect string like this **Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database
**Thanks
Chao
Wednesday, December 23, 2009 12:34 PM ✅Answered | 1 vote
ADOXcatalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pstrDB + ";Jet OLEDB:Database Password=test")
Monday, December 21, 2009 9:50 AM
Hi
Simple , YOu can add
User ID=myUsername;
values to Connection String for Accessing Access Database with Password
Monday, December 21, 2009 1:48 PM
When reading from the database I can use passwords/ueser names fine, simple connection string stuff.
But so far anytime I add in username/password info into connection string at creating a new database at the click of button I get exceptions.
"Cannot start your application. The workgroup information file is missing or opened exclusively by another user."
Monday, December 21, 2009 5:21 PM
Hi Rick Doll,
you get this exception at only once when you creating it, next time you will not get it.
I think , newly created access file is not closed
Tuesday, July 9, 2019 9:18 AM
Hi,
I restart this post because i try to create an Access database in C# using code like the one shown in the first message.
Unfortunately, when executing the line
cat.Create(..)
i get en exception (Microsoft OLE DB Service Components ErrorCode = 0x80040154) indicating a not registered component. I tried with ADOX 6.0 and with ADOX 2.8, same result. My App is generated for x64 platform, with net 4.6. My PC runs under W10pro, and i only installed access2016 'AccessDatabaseEngine_X64.exe'.
What do i have to do? install a full MS Office Access?
Regards