0
我有訪問密碼保護的數據庫。 我正在使用Visual Studio 2010和ODBC。用密碼保護的M Access 2003文件連接Visual Studio使用Odbc
必須添加什麼行代碼才能成功連接到訪問受保護的文件?
我使用這個代碼:
Imports System.Data.Odbc
Imports System
Public Class DatabaseFunctions
Shared con As OdbcConnection
Public Shared Sub CreateConnection()
con = New OdbcConnection
con.ConnectionString = "Dsn=XXX"
con.Open()
End Sub
Private Shared Sub CheckConnection()
If con Is Nothing OrElse con.State = ConnectionState.Closed Then
CreateConnection()
End If
End Sub
End Class