You must Sign In to post a response.
  • Category: .NET

    Exception in connection string

    Hi All,
    I'm trying to connect to MS access database.while connecting getting some exception like could not find the database.PFB exception.

    An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

    Additional information: Could not find file 'E:\OrgActivity\ORG Database.mdb'.

    My database is present in E:\Org Activity folder.

    do I need to add any references to the project.
    Connection string is following:
    OleDbConnection addCon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\\OrgActivity\\ORG Database.mdb;");
    Is there any mistake in my connection string.
    Please suggest me to resolve this exception.
    Thanks in advance.
  • #768779
    Hai Lakshmi,
    First of all you need to check that whether the correct version(12) of OLEDB driver is installed in to the system. Because if the version is not correct for the OLEDB driver, it will also through this type of error message.
    The next thing is to check the connection string where you also need to make sure that the password is required for the database or not. If the password is required, your connection string must include it.
    Below I am providing the sample connection strings, you can match it and use it as per the requirements:

    Standard Connection String:
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\OrgActivity\ORG Database.mdb;
    Persist Security Info=False;
    With Password:
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\OrgActivity\ORG Database.mdb;
    Jet OLEDB:Database Password=password;

    You can also check for other connection strings at the below links:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • Sign In to post your comments