title: Building an Connection string dynamically for MS Access vb.net
body: <p>Our legacy system is in ms access I need to build a connection string dyanmically that is laoded from an ini file I have got the path ok from the ini file however how do I create a connecting string dynamically bare in mind the ini file could contain a unc path ie \servername\folder\db.mdb</p>
  
  <p>Please no questions about why access this is a legacy system which I need to import into using .net </p>
  
  <p>Can someone help please thanks</p>
  
  <p>I have tried the follow but it fails to open the db </p>
  
  <pre><code>        Dim strFile As String = "C:\windows\figure.ini"
          Dim strRet As String
          Dim inifile As New IniFileManager
  
          strRet = inifile.ReadINI(strFile, "DATABASE SECTION", "FILENAME", "")
  
          Dim oleConn As System.Data.OleDb.OleDbConnection
          oleConn = New System.Data.OleDb.OleDbConnection
  
          oleConn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;" &amp; _
                                                      "Data Source=" + strRet)
  
          Try
              oleConn.Open()
          Catch ex As Exception
              MsgBox("Failed to open Database")
          End Try
  </code></pre>