VB 에서 multi-instance ODBC 등록방법
Visual Basic 6.0 에서 ODBC 자동으로 등록하는 함수를 만들 때
멀티인스턴스는 빨간색 부분에 서버명과 인스턴스명을 아래와 같이 적어야 제대로 동작한다
멀티 : "Address=\\서버명\pipe\ MSSQL$인스턴스명\sql\query"
단일 : "Address=\\서버명\pipe\sql\query"
Public Function gOdbcRegister(lDsn As String, lDriver As String, lServer As String, lDataBase As String) As Boolean
On Error GoTo CLEANUP
Dim lStrAttribs As String
gOdbcRegister = False
lStrAttribs = "Description=SQL Server on server:" & lServer & _
Chr$(13) & "OemToAnsi=No" _
& Chr$(13) & "QuotedID=No" _
& Chr$(13) & "TranslationOption=No" _
& Chr$(13) & "UseProcForPrepare=No" _
& Chr$(13) & "AnsiNPW=No" _
& Chr$(13) & "SERVER=" & lServer _
& Chr$(13) & "Network=DBNMPNTW" _
& Chr$(13) & "Database=" & lDataBase _
& Chr$(13) & "Address=\\서버명\pipe\ MSSQL$인스턴스명\sql\query"
rdoEngine. rdoRegisterDataSource lDsn, "SQL Server", True, lStrAttribs
'Sleep (1000)
gOdbcRegister = True
Exit Function
CLEANUP:
MsgBox "ODBC등록에러: " + ERR.description
gOdbcRegister = False
End Function
댓글
댓글 쓰기