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

[µo°Ý] °õ¦æADODB.Connection.Execute«áExcel¿ù»~­«±Ò

[µo°Ý] °õ¦æADODB.Connection.Execute«áExcel¿ù»~­«±Ò

¥»©«³Ì«á¥Ñ li_hsien ©ó 2016-5-27 09:44 ½s¿è

±`¥ÎVBA¤USQL»yªk¶i¦æ¸ê®Æ®w¬d¸ß

¦ý³o¦¸¨Ï¥ÎªºSQL»yªk¬d¸ß®É
°õ¦æ¨ìADODB.Connection.Execute(SQL»yªk)
Excel¾ã­Ó¿ù»~­«±Ò¡A¥X²{¦^³øµe­±


µ{¦¡½T»{¥i¥¿±`³sµ²DB¶i¦æ¬d¸ß

¹Á¸Õ¥H¸û²©ö²µuªºSQL¶i¦æ¬d¸ß¡A¬O¥i¥H¥¿±`¦L¥Xµ²ªG

¥i¯à¬O¥Ø«e©Ò­n°õ¦æªºSQL¤Óªø?JOIN¤Ó¦hTABLE? (JOIN¤T±iTABLE)

[SQL»yªk¤j­P¦p¤U]
  1. str = "select a.x1,b.x2,a.x3,d.x4,d.x5,d.x6,e.x7,e.x8 " & _
  2. "from AAA a " & _
  3. "join BBB b on a.iii=b.xxx " & _
  4. "join CCC c on a.jjj=c.yyy " & _
  5. "join DDD d on c.kkk=d.zzz or c.lll=d.mmm " & _
  6. "left join EEE e on d.nnn=e.ooo " & _
  7. "where a.ppp='" & Worksheets(1).TextBox1.Value & "'"
½Æ»s¥N½X
¦V¦U¦ì½Ð¯q¬O§_¦³¸Ñ¨M¤è®×

¦A½Ð«ü±Ð

ÁÂÁÂ !
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD