Public ocnAll As New ADODB.Connection 'main connection
Private Sub ocmRefresh_Click(Index As Integer)
On Error GoTo Err
DBtDriverMy = "{MySQL ODBC " & otbMyVer(Index).Text & " Driver}" '{MySQL ODBC 5.1 Driver}
ocnAll.ConnectionString = "Provider=MSDASQL;DRIVER=" & DBtDriverMy & "; UID=" & otbUsr(Index).Text & ";PWD=" & otbUsrP(Index).Text & ";DATABASE=" & ocbDB(Index).Text & ";SERVER=" & otbDB(Index).Text & ";" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841
ocnAll.CursorLocation = adUseClient
ocnAll.Open
' ocnFrom.Close
Exit Sub
Err:
Call MRF_STAxMouse(Me, False)
MsgBox "ติดต่อฐานข้อมูลไม่ได้ กรุณาตรวจสอบอีกครั้ง"
End Sub
Private Sub wTestMy()
Dim tSql As String
Dim oRs As New ADODB.Recordset
Dim nI As Integer
Dim tTemp As String
On Error GoTo Err
tSql = "SELECT VERSION(), CURRENT_DATE "
Set oRs = getCTS(tSql)
If Not (oRs.BOF And oRs.EOF) Then
tTemp = oRs("VERSION()")
MsgBox tTemp
tTemp = oRs("CURRENT_DATE")
MsgBox tTemp
End If
tSql = "SHOW TABLE STATUS "
Set oRs = ocnAll.Execute(tSql)
If Not (oRs.BOF And oRs.EOF) Then
oRs.MoveFirst
For nI = 0 To oRs.RecordCount - 1
tTemp = oRs("Name")
MsgBox tTemp
oRs.MoveNext
Next nI
End If
MsgBox "Coding OK."
Exit Sub
Err:
MsgBox "Error Number : " & Err.Number & " : " & Err.Description
End Sub
Public ocnAll As New ADODB.Connection 'main connection
Private Sub ocmRefresh_Click(Index As Integer)
On Error GoTo Err
DBtDriverMy = "{MySQL ODBC " & otbMyVer(Index).Text & " Driver}" '{MySQL ODBC 5.1 Driver}
ocnAll.ConnectionString = "Provider=MSDASQL;DRIVER=" & DBtDriverMy & "; UID=" & otbUsr(Index).Text & ";PWD=" & otbUsrP(Index).Text & ";DATABASE=" & ocbDB(Index).Text & ";SERVER=" & otbDB(Index).Text & ";" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841
ocnAll.CursorLocation = adUseClient
ocnAll.Open
' ocnAll.Close
Exit Sub
Err:
MsgBox "ติดต่อฐานข้อมูลไม่ได้ กรุณาตรวจสอบอีกครั้ง"
End Sub
Private Sub wTestMy()
Dim tSql As String
Dim oRsVer As New ADODB.Recordset
Dim oRs As New ADODB.Recordset
Dim nI As Integer
Dim tTemp As String
On Error GoTo Err
tSql = "SELECT VERSION(), CURRENT_DATE "
Set oRsVer = ocnAll.Execute(tSql)
If Not (oRsVer.BOF And oRsVer.EOF) Then
tTemp = oRsVer("VERSION()")
MsgBox tTemp
tTemp = oRsVer("CURRENT_DATE")
MsgBox tTemp
End If
tSql = "SHOW TABLE STATUS "
Set oRs = ocnAll.Execute(tSql)
If Not (oRs.BOF And oRs.EOF) Then
oRs.MoveFirst
For nI = 0 To oRs.RecordCount - 1
tTemp = oRs("Name")
MsgBox tTemp
oRs.MoveNext
Next nI
End If
MsgBox "Coding OK."
Exit Sub
Err:
MsgBox "Error Number : " & Err.Number & " : " & Err.Description
End Sub