Advanced DataGridView with Excel-Like AutoFilter Connection Problem to Access Database RRS feed

  • Question

  • Hi everyone,

    I would like to consult you about something I could not find on the Internet. A few days ago, I started to use "Advanced DataGridView with Excel-like Auto Filter" in my project.

    I downloaded it via Manage NuGet Packages section in Visual Studio 2017. The algorithm was developed by ADGV (https://adgv.codeplex.com/)
    It works absolutely great in terms of filtering and sorting the data which is coming from a non-encrypted access database. 

    However, today I decided to encrypt the same database and then when I started to run my code in Microsoft Visual Studio 2017, it gave an error as follows; 

    System.Data.OleDb.OleDbException: 'Invalid Password.'

    I must put mypassword inside the following code, but I could not manage it beacuse I don't know how to place a password defining code inside it.

    // TODO: This line of code loads data into the 'dENEMEDataSet.Tablo1' table

    Can someone please help me on that issue??

    Note: dENEME is the name of my access database file and tablo1 is the name of my table in that access file

    • Moved by Stanly Fan Monday, August 28, 2017 8:07 AM
    Saturday, August 19, 2017 6:57 PM

All replies

  • Hi AYKUT,

    For your question, I suggest you ask the author of the algorithm here.

    In fact, the DataGridView columns already support sorting.

    I would populate a DataTable with your data and then bind the DataGridView to myDataTable.DefaultView.

    You can filter the rows displayed by setting myDataTable.DefaultView.RowFilter.

    You could place Textboxes and/or Comboboxes above the DataGridView and update myDataTable.DefaultView.RowFilter as the input/selections change.

    Refer: C# Winforms DataGridView with sorting/filtering like Ms Excel.

    Also there is a document in MSDN: Building a Drop-Down Filter List for a DataGridView Column Header Cell.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,


    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.

    Monday, August 21, 2017 7:48 AM
  • Hello,

    You can alter your app.config file to include your password as shown below.

    <?xml version="1.0" encoding="utf-8" ?>
            <add name="WindowsFormsApp2.Properties.Settings.Database1ConnectionString"
                connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=True;Jet OLEDB:Database Password=password"
                providerName="System.Data.OleDb" />
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

    Then encrypt the app.config file which I shown in my MSDN code sample. For clarity, I include the class ConnectionProtection which requires you to add a reference to System.configuration, I create a new instance of the class as a private variable.

    using System;
    using System.Windows.Forms;
    namespace WindowsFormsApp2
        public partial class Form1 : Form
            ConnectionProtection operations =
                     new ConnectionProtection(Application.ExecutablePath);
            public Form1()
            private void customersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
            private void Form1_Load(object sender, EventArgs e)
                // The following line is needed once to encypt.
                // This decrypts the file
                // TODO: This line of code loads data into the 'database1DataSet.Customers' 
                // table. You can move, or remove it, as needed.
                // re-encrypt

    The runtime version of app.config as encrypted.

    <?xml version="1.0" encoding="utf-8" ?>
        <connectionStrings configProtectionProvider="DataProtectionConfigurationProvider">
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Proposed as answer by Stanly Fan Thursday, August 24, 2017 7:11 AM
    Monday, August 21, 2017 12:56 PM