返回列表 上一主題 發帖

[發問] 請問如何讀取MSQL裡的binary資料至excel裡

[發問] 請問如何讀取MSQL裡的binary資料至excel裡

最近需要從mysql的資料庫中抓資料到excel進行分析
但在運作的過程中,發現若是binary的資料則無法讀取
讀出來的結果也是空白的,不曉得各位前輩是否能幫忙解決,謝謝!!
以下是我的code

Private Sub DataUpdate()

Dim oConn As ADODB.Connection
Dim myRS As ADODB.Recordset
Dim mySQL As String
Dim LastR As Long

Set oConn = New ADODB.Connection
Set myRS = New ADODB.Recordset
oConn.Open "DRIVER={MySQL ODBC 5.2a Driver};" _
           & "SERVER=localhost;" & "DATABASE=test;" & "USER=root;" _
           & "PASSWORD=XXXXXXX;" & "Option=3"

mySQL = "select * from `test` "
myRS.Open mySQL, oConn

With Worksheets(1)

    LastR = .Range("A65536").End(xlUp).Row

    Do While Not myRS.EOF        
        .Cells(LastR + 1, 1) = myRS.Fields(0)
        myRS.MoveNext
        LastR = LastR + 1
    Loop

End With

Set oConn = Nothing
Set myRS = Nothing

End Sub

        靜思自在 : 我們要做好社會的環保,也要做好內心的環保。
返回列表 上一主題