I am trying to connect a VB project to an Access Database. The Access Database is in use. I seem to be able to connect when the database is not in use but then I lock out the operators that need the program that runs from the Access database. I have verified that the Access database has "open mode is Shared and the preferred default record locking is none. My code is:
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.OleDb.OleDbPer
mission
Imports System.Security
Imports System.Security.Permission
s
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New OleDb.OleDbConnection
Dim permission As OleDbPermission = New OleDbPermission(Permission
State.None
)
con.ConnectionString = "PROVIDER=Microsoft.Jet.OL
EDB.4.0;Da
ta Source=\\Computer Name\c$\Program Files\Folder Name\AccessDBName.mdb"
con.Open()
Debug.WriteLine("A Connection to the Database is now open")
con.Close()
Debug.WriteLine("A Connection to the Database is now closed")
End Sub
End Class
I really need help on this. An associate of mine is able to connect to a similar database using VB6 at a different location.
Start Free Trial