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

VBA ³s½u MySQL

VBA ³s½u MySQL

¦bºô¸ô¤W§äªº«Ü¦h³s½u¸ê®Æ³£¬O­n¥ý¦w¸ËMYSQLªºDRIVER

¦]¬°¤p§Ì­n°µªºTOOL¬O­nµ¹«Ü¦h¤H¨Ï¥Î¡A¨S¿ìªk½T«O¨C¦ì¢ý¢û¢í¢ú³£·|³]©w

¦³¨S¦³¿ìªk¦b¤£³]©w¤Þ¥Î¶µ¥Øªº«e´£¤§¤U¡A³]©w»Pmysql³s½u©O¡H

§Y¬O¨Ï¥Î³s½u¦r¦ê¡B³]©wª«¥óªº¤è¦¡µ¥...

³oÃä©ß¿j¤Þ¥É¤@¤U¡A§Ú´£¨ÑMSSQLªº³]©w¡A§Ú¥Î³oºØ¤è¦¡ªº¸Ü¡A¢ã¢á¢Ó¢à´N¤£¥Î³]©w¤Þ¥Î¿ï¶µ¨º¨Ç¡Aª½±µ°õ¦æ´N·|³s½u¥hDB¼´¸ê®Æ¤F
ActiveWorkbook.Worksheets.Add
ActiveSheet.Name = Sheets("Config").Range("B" & i)
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array("OLEDB;Provider=SQLOLEDB.1;Password=xxx;User ID=xxx;Trusted_Connection=False;Persist Security Info=True;Data Source=projdb;Use Procedure for Prepare=1;Auto Tran" _
    , _
    "slate=True;Use Encryption for Data=False;Tag with column collation when possible=False;Initial Catalog=Mantis_Mirror"), Destination:=Range("$A$1")).QueryTable
    .CommandType = xlCmdSql
    .CommandText = Array("SELECT * FROM xxx " & Query_Mysql & Query_Date_Start & Query_Date_End)
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = False
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = True
    .SaveData = True
    .AdjustColumnWidth = False
    .RefreshPeriod = 0
    .PreserveColumnInfo = True
    .ListObject.DisplayName = Sheets("Config").Range("B" & i)
    .Refresh BackgroundQuery:=False
End With

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD