Not a valid file name error while connecting to access 2013 database via VB.NET 2010
<p>I had to make a clean system install and I lost a project I was making. I then started it from scratch but have difficulties with connection. I get the error &quot;Not a valid file name.&quot; The weird thing is that I am able to retrieve data for a combo box. Here are the exception details :</p>
<pre><code>Interception de System.Data.OleDb.OleDbException
  ErrorCode=-2147467259
  HResult=-2147467259
  Message=Not a valid file name.
  Source=Microsoft Office Access Database Engine
  StackTrace:
       à System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       à System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       à System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
       à System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       à System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)
       à System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       à System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       à System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       à System.Data.OleDb.OleDbConnection.Open()
       à GestBanque.Securite.rechutil() dans F:\CODEBASE\HLVL\DotNet\GestBanque\GestBanque\Securite.vb:ligne 39
  InnerException: 
</code></pre>
<p>Here is the faulty code :</p>
<pre><code>Private Sub rechutil()
        Try
            Dim dr As OleDbDataReader
            Dim cmdselect As New OleDbCommand
            Dim sql As String
            Dim cn As String
            Dim sconnexion As OleDbConnection
            cn = &quot;provider=Microsoft.ACE.OLEDB.12.0;Password=;User ID=Admin;Data Source=‪F:\GPI3\GestBanque.accdb&quot;
            sconnexion = New OleDbConnection(cn)
            sconnexion.Open() ' The error is raised here
            cmdselect.Connection = sconnexion
            cmdselect.CommandType = CommandType.Text
            sql = &quot;SELECT nom, motdepasse FROM UTILISATEUR WHERE nom=? AND motdepasse=?&quot;
            cmdselect.CommandText = sql
            cmdselect.Parameters.Add(&quot;no&quot;, OleDbType.Char)
            cmdselect.Parameters.Add(&quot;mo&quot;, OleDbType.Char)
            cmdselect.Parameters(&quot;no&quot;).Value = cmbnom.Text
            cmdselect.Parameters(&quot;mo&quot;).Value = txtpass.Text
            dr = cmdselect.ExecuteReader
            If dr.HasRows Then
                Accueil.Show()
            Else
                MessageBox.Show(&quot;Désolé, Accès refusé, Mot de passe erronné&quot;, &quot;Authentification&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error)
                cmbnom.Text = &quot;&quot;
                txtpass.Text = &quot;&quot;
            End If
            sconnexion.Close()
        Catch ex As Exception
            MessageBox.Show(ex.Message, &quot;Authentification&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
</code></pre>
<p>On the contrary, this procedure works perfectly well :</p>
<pre><code>Private Sub loadcombo()
        Try
            Dim dr As OleDbDataReader
            Dim cmdselect As New OleDbCommand
            Dim sql As String
            Dim cn As String
            Dim sconnexion As OleDbConnection
            cn = &quot;provider=Microsoft.ACE.OLEDB.12.0;Password=;User ID=Admin;Data Source=F:\GPI3\GestBanque.accdb&quot;
            sconnexion = New OleDbConnection(cn)
            sconnexion.Open()
            cmdselect.Connection = sconnexion
            cmdselect.CommandType = CommandType.Text
            sql = &quot;SELECT nom FROM UTILISATEUR ORDER BY nom&quot;
            cmdselect.CommandText = sql
            dr = cmdselect.ExecuteReader
            cmbnom.Items.Clear()
            While dr.Read
                cmbnom.Items.Add(dr.GetValue(0))
            End While
            sconnexion.Close()
        Catch ex As Exception
            MessageBox.Show(ex.Message, &quot;Chargement des noms&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub.
</code></pre>
<p>Here is a screen capture : <a href="https://www.dropbox.com/s/lnjix59o1q1wf1j/Capture%20d%27%C3%A9cran%202016-06-27%2010.49.46.png?dl=0" rel="nofollow noreferrer">Screen capt</a></p>
<p>I've been searching for about a month but found no solution on various forums.
Thanks in advance.</p>