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

µ¥«Ý¤W¤@µ{¦¡§¹¦¨, ¤~°õ¦æ¤U¤@¬qµ{¦¡

µ¥«Ý¤W¤@µ{¦¡§¹¦¨, ¤~°õ¦æ¤U¤@¬qµ{¦¡

¦³¤@vba »ÝŪ¨ú ms sql ¸ê®Æ, ¤Î½Æ¨î¨ì¥t¤@¤u§@­¶,
¦ý¥Ñ©óŪ¨ú ms sql ¸ê®Æ¤´¥¼§ó·s§¹¦¨, ¤w½Æ¨îªÅ¥Õ¸ê®Æ¨ì·s¤@­¶,
¦³¦ó¤è¦¡µ¥«Ý¤W¤@µ{°õ¦æ§¹¦¨, (§ó·s¸ê®Æ)¤~¦A°õ¦æ,
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

¦^´_ 1# sammyc
¸Õ¸Õ¬Ý
Selection.QueryTable.Refresh BackgroundQuery:=False

TOP

¦^´_ 2# GBKEE

°õ¦æ¨ì¦¹¥y, ¤Ë²{¿ù»~
  1. Sub l_style()
  2. '
  3.     Dim ST_NO
  4.     ST_NO = Application.InputBox("¿é¤J´Ú¸¹", "¿é¤J´Ú¸¹", "", 200, 100)
  5.     ST_NO = UCase(ST_NO)
  6.    
  7. '    Sheets("stylebom").Select
  8. 'Cells(2, 2) = "& st_no"

  9.     Sheets("stylebom").Range("E3") = ST_NO


  10.    
  11.     Application.CutCopyMode = False
  12.     With ActiveWorkbook.Connections( _
  13.         "192.168.101.203 Garment01 TxProjMatStyCons").OLEDBConnection
  14.         .BackgroundQuery = True
  15.         .CommandText = Array(  "SELECT  * from table 1 where style = '" & ST_NO & "'"  )
  16.         .CommandType = xlCmdSql
  17.         .Connection = Array( _
  18.         "OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=Garment01;Data Source=192.16" _
  19.         , _
  20.         "8.101.203;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=CWST021;Use Encryption for Data=False;" _
  21.         , "Tag with column collation when possible=False")
  22.         .RefreshOnFileOpen = False
  23.         .SavePassword = False
  24.         .SourceConnectionFile = ""
  25.         .SourceDataFile = ""
  26.         .ServerCredentialsMethod = xlCredentialsMethodIntegrated
  27.     End With
  28.     With ActiveWorkbook.Connections( _
  29.         "192.168.101.203 DtradeSimpleGarment01 TxProjMatStyCons")
  30.         .Name = "192.168.101.203 DtradeSimpleGarment01 TxProjMatStyCons"
  31.         .Description = ""
  32.     End With
  33.     ActiveWorkbook.Connections( _
  34.         "192.168.101.203 DtradeSimpleGarment01 TxProjMatStyCons").Refresh
  35.             Selection.QueryTable.Refresh BackgroundQuery:=False
  36. Call c_new
  37. End Sub
½Æ»s¥N½X
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 3# sammyc
¸Õ¸Õ¬Ý
ActiveWorkbook.Connections("192.168.101.203 DtradeSimpleGarment01 TxProjMatStyCons").Refresh  BackgroundQuery:= False

TOP

¤´¬O¤£¦æ, ¦æ¨ì¦¹®É¥X¿ù»~
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i°±º¢¤£«e¡A²×µL©Ò±o¡j¤H³£°g©ó´M§ä©_ÂÝ¡A¦]¦Ó°±º¢¤£«e¡FÁa¨Ï®É¶¡¦A¦h¡B¸ô¦Aªø¡A¤]¤FµL¥Î³B¡A²×µL©Ò±o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD