ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦p¦óŪ¨úMSQL¸Ìªºbinary¸ê®Æ¦Üexcel¸Ì

[µo°Ý] ½Ð°Ý¦p¦óŪ¨úMSQL¸Ìªºbinary¸ê®Æ¦Üexcel¸Ì

³Ìªñ»Ý­n±qmysqlªº¸ê®Æ®w¤¤§ì¸ê®Æ¨ìexcel¶i¦æ¤ÀªR
¦ý¦b¹B§@ªº¹Lµ{¤¤¡Aµo²{­Y¬Obinaryªº¸ê®Æ«hµLªkŪ¨ú
Ū¥X¨Óªºµ²ªG¤]¬OªÅ¥Õªº¡A¤£¾å±o¦U¦ì«e½ú¬O§_¯àÀ°¦£¸Ñ¨M¡AÁÂÁÂ!!
¥H¤U¬O§Úªº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

¦^´_ 1# sasho

§A¸ê®Æ®w¤¤ binary ªº¸ê®Æ¤º®e­Y­nÅã¥Ü¥X¨Ó·|¬O¥i¨£ªº¤å¦r¶Ü(§Y¬O BIG5 <©Î UTF-8> ½s½X¤U¥i¬Ý¨ìªº¤å¦r)?

¤@¯ë¨Ó»¡ Excel ªºÀx¦s®æ¨Ã¤£¯à§â¤£¥i¨£¤å¦rÅã¥Ü¥X¨Ó,
©Ò¥H§A¥i¯à»Ý­nÂǥѵ{¦¡,
©Î¬O³]­Ó¹ï·Óªí¤§Ãþªº¤è¦¡,
§â binary ªº¸ê®Æ¤º®eÂন§Ú­Ì·Q­n¬Ý¨ìªº¤å¦r¦A©ñ¶iÀx¦s®æ¤º,
Excel ¨Ã¤£·|¦bŪ¨ú binary ¸ê®Æ®É,
¦Û°Ê¥N´«¦¨ FF AB ... ©Î¬O 10010110 ... ¤§Ãþªº¤å¦r.

¹ê§@¤W§A¥i¥H¥ý±N¸ê®ÆŪ¨ì Variant ÅܼƤº,
¦A³z¹Lµ{¦¡Âন§A·Q­n¬Ý¨ìªº¤å¦r.

TOP

        ÀR«ä¦Û¦b : §ïÅܦۤv¬O¦Û±Ï¡A¼vÅT§O¤H¬O±Ï¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD