VB mysql odbc 자동설정 배포파일 만들기
페이지 정보
작성자
본문
VB + MySQL ODBC 자동설정 배포파일 만들기
몇일동안 어떻게 할까 고민하다가 인스톨팩토리 가지고 놀다가 드디어 성공했습니다. 우선 myodbc3.dll <- 요 파일만 있으면 됩니다.
아래 이미지에 없는 부분을 그냥 두셔도 됩니다. |










아래.. 연결 소스입니다.
Private rs As ADODB.Recordset
Private cn As ADODB.Connection
'------------------------------------------------------------------------------
'Form_Load
'------------------------------------------------------------------------------
Private Sub Form_Load()
Set cn = New ADODB.Connection
Dim strconnect As String
strconnect = "driver={MySQL ODBC 3.51 Driver};server=아이피입력;uid=아이디입력;pwd=패스워드입력;database=연결할DB명;dsn=데이터소스이름"
cn.ConnectionString = strconnect
cn.Open ConnectionString
cn.CursorLocation = adUseClient
SSTab1.Tab = 0
On Error GoTo 0
Form_Load_Exit:
Exit Sub
Error:
MsgBox Err.Description, vbExclamation, "Error in [Form_Load]"
End Sub
'------------------------------------------------------------------------------
'Function 검색버튼 클릭( 검색 아무거나 해볼께요)
'------------------------------------------------------------------------------
Private Sub cmdFunctionSearch_Click()
Set rs = New ADODB.Recordset
Dim sql As String
sql = "select t1.*,t2.indName from IndustryFunction as t1, Industry as t2 where t1.indIdx=t2.indIdx"
rs.Open sql, cn, adOpenStatic
If rs.EOF Then
lstFunction.ListItems.Clear
MsgBox "검색된 결과가 없습니다.", vbInformation, "검색된 결과가 없습니다."
txtFunctionSearch.Text = ""
Else
Call LoadResultFunction(rs) '<- 검색된 결과를 listView 에 뿌려줍니다.
End If
If Not IsNull(rs) Then
rs.Close
End If
On Error GoTo 0
cmdFunctionSearch_Click_Exit:
Exit Sub
Error:
MsgBox Err.Description, vbExclamation, "Error in [cmdFunctionSearch_Click]"
End Sub
'------------------------------------------------------------------------------
'Form unload
'------------------------------------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
If Not IsNull(cn) Then
cn.Close
End If
End Sub
관련링크
댓글목록
등록된 댓글이 없습니다.