728x90
반응형
728x170
Public Function GetMDBConnection(strMDBFilePath As String) As ADODB.Connection
Dim pConnection As ADODB.Connection
Dim strConnectionString As String
Set GetMDBConnection = Nothing
On Error GoTo ErrorLabel
Set pConnection = New ADODB.Connection
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMDBFilePath
pConnection.Open strConnectionString
On Error GoTo 0
Set GetMDBConnection = pConnection
Exit Function
ErrorLabel:
End Function
Public Function GetMDBConnection(strMDBFilePath As String, strUserID As String, strPassword As String) As ADODB.Connection
Dim pConnection As ADODB.Connection
Dim strConnectionString As String
Set GetMDBConnection = Nothing
On Error GoTo ErrorLabel
Set pConnection = New ADODB.Connection
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMDBFilePath + ";User ID=" + strUserID + ";Jet OLEDB:Database Password=" + strPassword
pConnection.Open strConnectionString
On Error GoTo 0
Set GetMDBConnection = pConnection
Exit Function
ErrorLabel:
End Function
728x90
반응형
그리드형(광고전용)
'VB' 카테고리의 다른 글
[VB] SELECT SQL 실행하기 (0) | 2015.05.15 |
---|---|
[VB] 파라미터 추가하기 (0) | 2015.05.15 |
[VB] 명령 구하기 (0) | 2015.05.15 |
[VB] SELECT SQL 실행하기 (0) | 2015.05.15 |
[VB] 레코드셋 구하기 (0) | 2015.05.15 |
[VB] 애플리케이션 경로 구하기 (0) | 2015.05.15 |
[VB] 함수 프로시저 사용하기 (0) | 2015.05.15 |
[VB] 속성 사용하기 (0) | 2015.05.15 |
[VB] FOR ~ TO ~ STEP ~ EXIT FOR ~ NEXT문 사용하기 (0) | 2015.05.15 |
[VB] 키보드 & 마우스 잠그기 (0) | 2015.05.15 |
댓글을 달아 주세요