paulked
09-22-2019, 07:01 PM
Hi all
After querying a database with
Sub GetAppData()
If Not IsInternetConnected Then
If Data.Cells(2, 2) <> 1 Then frmNoInternet.Show
Exit Sub
End If
Dim cn As New ADODB.Connection, rs As New ADODB.Recordset, i As Long
On Error GoTo Link
Conn:
#If Win64 Then
cn.Open "Provider=MSDASQL;DRIVER={mysql odbc 5.2 unicode driver}" _
& ";SERVER=localhost" _
& ";PORT=3306" _
& ";DATABASE=fringell_DbgTfg0O" _
& ";UID=" _
& ";PWD="
#Else
cn.Open "DRIVER={MySQL ODBC 3.51 Driver}" _
& ";SERVER=localhost" _
& ";PORT=3306" _
& ";DATABASE=fringell_DbgTfg0O" _
& ";UID=" _
& ";PWD="
#End If
On Error GoTo Oops
rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM jos_visforms_1", cn, adOpenDynamic
With AppData
.Cells.ClearContents
For i = 0 To rs.Fields.Count - 1
.Cells(1, i + 1) = rs.Fields(i).Name
Next
.Cells(2, 1).CopyFromRecordset rs
End With
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
Exit Sub
Link:
Dim yesno As String
yesno = MsgBox("It looks like you are not connected through the SSH Tunnel. Do you want to try connecting now?", _
vbYesNo + vbInformation, "No connection to Database...")
If yesno = vbYes Then
PlinkConnect
GoTo Conn
End If
Oops:
MsgBox Err.Number & "; " & Err.Description
End Sub
I get all the data in the table from all fields except one.
Example
Record contains
I'm getting
Fri 17, Sat 18, Fri 24, Sat 25
Fri 17
Sun 19, Mon 20, Tue 21, Sun 26
Sun 19
There are other fields in the DB that contain commas but I'm getting those ok.
Any ideas?
After querying a database with
Sub GetAppData()
If Not IsInternetConnected Then
If Data.Cells(2, 2) <> 1 Then frmNoInternet.Show
Exit Sub
End If
Dim cn As New ADODB.Connection, rs As New ADODB.Recordset, i As Long
On Error GoTo Link
Conn:
#If Win64 Then
cn.Open "Provider=MSDASQL;DRIVER={mysql odbc 5.2 unicode driver}" _
& ";SERVER=localhost" _
& ";PORT=3306" _
& ";DATABASE=fringell_DbgTfg0O" _
& ";UID=" _
& ";PWD="
#Else
cn.Open "DRIVER={MySQL ODBC 3.51 Driver}" _
& ";SERVER=localhost" _
& ";PORT=3306" _
& ";DATABASE=fringell_DbgTfg0O" _
& ";UID=" _
& ";PWD="
#End If
On Error GoTo Oops
rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM jos_visforms_1", cn, adOpenDynamic
With AppData
.Cells.ClearContents
For i = 0 To rs.Fields.Count - 1
.Cells(1, i + 1) = rs.Fields(i).Name
Next
.Cells(2, 1).CopyFromRecordset rs
End With
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
Exit Sub
Link:
Dim yesno As String
yesno = MsgBox("It looks like you are not connected through the SSH Tunnel. Do you want to try connecting now?", _
vbYesNo + vbInformation, "No connection to Database...")
If yesno = vbYes Then
PlinkConnect
GoTo Conn
End If
Oops:
MsgBox Err.Number & "; " & Err.Description
End Sub
I get all the data in the table from all fields except one.
Example
Record contains
I'm getting
Fri 17, Sat 18, Fri 24, Sat 25
Fri 17
Sun 19, Mon 20, Tue 21, Sun 26
Sun 19
There are other fields in the DB that contain commas but I'm getting those ok.
Any ideas?