locked
How to allow user to read application if MS Access protected password is given correct in Windows C# RRS feed

  • Question

  • Hi,

    i am using Windows application.

    my client want to set password in MS Access DB.

    When end user selecting the file from browse button, system should check the password and set password somewhere in the application.

    if the set password and Access password is match then system allow further process.

    How to do this in Windows C# applications.?

    • Moved by CoolDadTx Monday, July 16, 2018 2:07 PM Office related
    Monday, July 16, 2018 1:57 PM

Answers

  • Hello Gani tpt,

    You could try to use OpenCurrentDatabase to open a database with a password.

    Here is the example code.

     Access.Application application = new Access.Application();
                application.Visible = true;
                application.OpenCurrentDatabase(filepath: @"C:\Users\terryx\Desktop\TestFolder\Database1.accdb", bstrPassword: "123");

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Terry Xu - MSFT Tuesday, July 17, 2018 2:46 AM
    • Marked as answer by Gani tpt Thursday, July 19, 2018 10:26 AM
    Tuesday, July 17, 2018 2:37 AM

All replies

  • Hello Gani tpt,

    You could try to use OpenCurrentDatabase to open a database with a password.

    Here is the example code.

     Access.Application application = new Access.Application();
                application.Visible = true;
                application.OpenCurrentDatabase(filepath: @"C:\Users\terryx\Desktop\TestFolder\Database1.accdb", bstrPassword: "123");

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Terry Xu - MSFT Tuesday, July 17, 2018 2:46 AM
    • Marked as answer by Gani tpt Thursday, July 19, 2018 10:26 AM
    Tuesday, July 17, 2018 2:37 AM
  • Thanks..
    Thursday, July 19, 2018 10:26 AM