none
Access DB error when connection to Visual Studio 2019 RRS feed

  • Question

  • After creation Access 2016 database I try to connect Visual Studio 2019 to it (Add new data source -> Database -> Dataset -> New connection). And after "save the connection string to the application configuration file" I have this error:
    "An error occurred while creating the new data source: An error occurred while generating the data source".

    • Edited by Pankario Sunday, November 17, 2019 11:15 PM
    Sunday, November 17, 2019 11:11 PM

Answers

  • Thank you for answer.

    Yes, I can select "Test Connection", test connection succeeded.

    Provider is Microsoft.Jet.OLEDB.4.0.

    That is the incorrect provider, the correct provider is Microsoft.ACE.OLEDB.12.0.

    Microsoft.Jet.OLEDB.4.0 is for .mdb, Microsoft.ACE.OLEDB.12.0 is for .accdb.


    Please remember to mark the replies as answers if they help and unmarked 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.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Pankario Monday, November 18, 2019 11:14 AM
    Monday, November 18, 2019 11:13 AM
    Moderator

All replies

  • The first thing to check is, does the database have a database password, if so try removing it as there are two different password types were one will fail. If this is the case after removal of the password it works I can guide you through how to enable a password.

    Assuming you are attempting to create the DataSet via the Data Source windows, add new data source what is the data provider listed under the "Advance" button on the dialog labeled "Add Connection" ?

    And do you get to the point you can select the database then press "Test Connection" button?

    On a side note, using the approach you are trying can be troublesome and would suggest either a) writing code using OleDb data provider (there are plenty of code samples on the web) or try using Entity Framework Core with the following provider.

     


    Please remember to mark the replies as answers if they help and unmarked 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.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, November 18, 2019 1:27 AM
    Moderator
  • Hi Pankario, 

    Thank you for posting here.

    According to your description, your issue is more related to Access database. Therefore, it will be more appropriate to ask your question in Access for Developers forum.

    The C# forum is for C# related question, we discuss and ask the C# programming language, IDE, libraries, samples and tools here.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    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, November 18, 2019 1:33 AM
    Moderator
  • Thank you for answer.

    Yes, I can select "Test Connection", test connection succeeded.

    Provider is Microsoft.Jet.OLEDB.4.0.

    Monday, November 18, 2019 9:46 AM
  • Thank you for answer.

    Yes, I can select "Test Connection", test connection succeeded.

    Provider is Microsoft.Jet.OLEDB.4.0.

    That is the incorrect provider, the correct provider is Microsoft.ACE.OLEDB.12.0.

    Microsoft.Jet.OLEDB.4.0 is for .mdb, Microsoft.ACE.OLEDB.12.0 is for .accdb.


    Please remember to mark the replies as answers if they help and unmarked 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.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Pankario Monday, November 18, 2019 11:14 AM
    Monday, November 18, 2019 11:13 AM
    Moderator