Gary K
5/5/2005 11:40:00 PM
Greetings & Salutations,
I am having a few problems trying to get the .NET data framework to work
properly with Access database files (suprised?)
I breifly investigated using ODBC to connect to my database, however, I was
unable to locate any facilities that would enable me to open a password
protected database file. So there goes that idea.
I found that OLEDB would handle pretty much all of my needs, however, I am
unable to get the password changing SQL statement to work.
I can open a password protected database by adding the "Jet OLEDB:Database
Password" property to the connection string, and OleDbConnection seems to
handle all the other Jet-specific properties. Unfortunately I cannot get the
SQL command "ALTER DATABASE PASSWORD" to work.
I found this little tidbit in the Access documentation, and it will work in
VBA code, but when I use it with .NET I always, ALWAYS, get a "Not a Valid
Password" error (unless I get a syntax error while experimenting). I have
tried using parameters with the command object, constructing a single command
string without parameters & using delimiters of all sorts, no luck.
Can someone please help me work out how to get this to work?, otherwise I'll
have to go back to C++.
I have found the footnote in the documentation that the password changing
SQL statement will only work with the Jet OLE DB provider and ADO, so I
suppose that part of my question is how can I ensure that the OleDbConnection
object is using the right provider. I am using the
"Provider=Microsoft.Jet.OLEDB.4.0" string, and I am having no problems with
any other database function, so what is going on here?
Thanks for reading this far :)