how to change ms access database password in c#?

hi,

how to change the ms access database password in c# i search through the web and found one in VBA but not in C#. http://support.microsoft.com/kb/170961

Please give some hints. Thank you.

regrads,
chunket


Answer this question

how to change ms access database password in c#?

  • Evan Mulawski

    I doubt it's possible.

    Charles


  • schmod54


    First you need to open the database for exclusive access. Below is a sample connection string:

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Test Files\Access2000.mdb;Jet OLEDB:Database Password=currentpassword;Mode=Share Exclusive"

    Then you can execute the following Jet SQL (ExecuteNonQuery):

    "ALTER DATABASE PASSWORD newpassword currentpassword"



  • Jonas.S

    How I can clear password or set blank password
    Can I use password with blank

  • acf


    Yes, I believe you specify the new password value as Null.

  • John Mathews

    bump - still awaiting reply
  • pasha2k

    Thank a lot. I'm sorry, I forgot about "specific" qoute "`" in Access.
    ALTER DATABASE PASSWORD `currentpassword` `` - set password
    ALTER DATABASE PASSWORD `newpassword` `currentpassword` - change password
    ALTER DATABASE PASSWORD `` `newpassword` - clear password
    All work fine.
    Which limit for passord (length, symbols) (when I test I can create password with 20 symbl.)

  • how to change ms access database password in c#?