title: how to connect to a secured ms access database via vb.net using oledb
body: <p>I have a database database1.mdb created in ms access 10.</p>
  
  <p>I opened it in exclusive mode and set the password to abcd12.<br>
  I am using vb.net to INSERT data &amp; DELETE data from that database but somehow it is not able to connect.  Any ideas why connection cant be made?</p>
  
  <pre><code>Dim FilePath As String = "C:\Users\johnny\database1.mdb"
  dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &amp; _ 
  FilePath &amp; ";Jet OLEDB:Database Password=abcd12;")
  </code></pre>
  
  <p>Insert statement below:</p>
  
  <pre><code>dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &amp; FilePath &amp; ";Jet OLEDB:Database Password=abcd12;")
      Try
          dbconn.Open()
          strSQL = "INSERT INTO myTable ([col1],[col2],[col3],[col4],[col5]) VALUES (?,?,?,?,?)"
          objcmd = New OleDbCommand(strSQL, dbconn)
  
          objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@col1", "user12345"))    
          objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@col2", "user2345"))
          objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@col3", "user3456"))
          objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@col4", "user4567"))       
          objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@col5", "user5678"))
          objcmd.ExecuteNonQuery()
          dbconn.Close()
      Catch myException As System.Exception
          Windows.Forms.MessageBox.Show(myException.Message)
      End Try
  </code></pre>