title: C# OLEDB Database Connection Using Access 2016
body: <p>I have been trying to get a database connection using OLEDB and Access 2016 unfortunately however I am continuously returned the error:</p>
  
  <pre><code>    System.Data.OleDb.OleDbException was unhandled
    ErrorCode=-2147467259
    HResult=-2147467259
    Message=Not a valid file name.
    Source=Microsoft Office Access Database Engine
    StackTrace:
         at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
         at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
         at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
         at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
         at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)
         at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
         at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
         at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
         at System.Data.OleDb.OleDbConnection.Open()
         at Program_V1._0.Form1..ctor() in C:\Users\Tom\Documents\College\Computer_Science_Project _2017_Ver2.0\Program_Files\Program_V1.0\Program_V1.0\Form1.cs:line 24
         at Program_V1._0.Program.Main() in C:\Users\Tom\Documents\College\Computer_Science_Project _2017_Ver2.0\Program_Files\Program_V1.0\Program_V1.0\Program.cs:line 19
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>
  
  <p>From this section of code:</p>
  
  <pre><code>    //Database Connection
      OleDbConnection connection = new OleDbConnection();
      connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=‪C:\Users\Tom\Documents\College\Computer_Science_Project _2017_Ver2.0\Program_Files\Program_V1.0\Program_V1.0\Databases\DecodeTimes.accdb;
      Persist Security Info=False;";
      connection.Open();
      label3.Text = " - Database Connected - ";
      connection.Close();
  </code></pre>
  
  <p>Try as I might I cannot see any issue with this even after reading about issues regarding compatibility, any help would be greatly appreciated. </p>