°õ¦æ¶¥¬q¿ù»~13 «¬ºA¤£²Å¦X
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
°õ¦æ¶¥¬q¿ù»~13 «¬ºA¤£²Å¦X
¥»©«³Ì«á¥Ñ joey0415 ©ó 2010-6-25 19:21 ½s¿è
¤p§Ì±N¿ý»sªº¥N½X(¤w¦¨¥\¥i¥Î)
§ï¦¨¤ñ¸û¦n¬Ýªº¥N½X(¥¢±Ñ)
¥i¥HÀ°§Ú¬Ý¬Ý¬OþùØ¿ù»~¶Ü¡H
¤p§Ì§ïÅÜsql»y¥yªº¼gªk¡A±`±`sql»y¥y«Üµuªº®ÉÔ¡A¨âºØ¤èªk³£¦æ¡A¤@¦ýsqlªº»y¥yÅܪø®É¡A´N·|¦³¤U±ªº¿ù»~- Sub day150_1()
- '
- ' day150_1 Macro
- Sheets("Sheet1").Select
- Range("A1").Select
- With ActiveSheet.QueryTables.Add(Connection:= _
- "ODBC;DRIVER=SQL Server;SERVER=.;UID=sa;PWD=abcd1234;APP=2007 Microsoft Office system;WSID=CS5111;DATABASE=stock" _
- , Destination:=Range("A1"))
- .CommandText = Array( _
- "select a.*,b.*,c.*,d.*" & Chr(13) & "" & Chr(10) & " from dbo.Stock a" & Chr(13) & "" & Chr(10) & "left join dbo.CreditExchange b on a.sdate=b.sdate and a.stockid=b.stockid" & Chr(13) & "" & Chr(10) & " left join dbo.NLDL c on a.sdate=c.sdate and a.stockid=c.stockid " & Chr(13) & "" & Chr(10) & " left join dbo." _
- , _
- "CompTrade d on a.sdate=d.sdate and a.stockid=d.stockid" & Chr(13) & "" & Chr(10) & " where a.stockid>1000 and a.stockid<2000 and a.sdate>='2009-11-09' order by a.stockid ,a.sdate" & Chr(13) & "" & Chr(10) & "" _
- )
- .Name = "day150_1"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .BackgroundQuery = True
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = True
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .PreserveColumnInfo = True
- .Refresh BackgroundQuery:=False
- End With
- End Sub
½Æ»s¥N½X ¿ù»~¥N½X¡G
´N¬O³o¥y¦³°ÝÃD
.CommandText = Array(ssql)- Sub day150_11()
- '
- ' day150_1 Macro
- Dim ssql As String
- ssql = ""
- ssql = ssql & "select a.*,b.*,c.*,d.* from dbo.Stock a" & Chr(13)
- ssql = ssql & "left join dbo.CreditExchange b on a.sdate=b.sdate and a.stockid=b.stockid" & Chr(13)
- ssql = ssql & "left join dbo.NLDL c on a.sdate=c.sdate and a.stockid=c.stockid" & Chr(13)
- ssql = ssql & "left join dbo.CompTrade d on a.sdate=d.sdate and a.stockid=d.stockid" & Chr(13)
- ssql = ssql & "where a.stockid>1000 and a.stockid<2000 and a.sdate>='2009-11-09'" & Chr(13)
- ssql = ssql & "order by a.stockid ,a.sdate" & Chr(13)
- Sheets("Sheet1").Select
- Range("A1").Select
- With ActiveSheet.QueryTables.Add(Connection:= _
- "ODBC;DRIVER=SQL Server;SERVER=.;UID=sa;PWD=abcd1234;APP=2007 Microsoft Office system;WSID=CS5111;DATABASE=stock" _
- , Destination:=Range("A1"))
- .CommandText = Array(ssql)
- .Name = "day150_1"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = True
- .RefreshOnFileOpen = False
- .BackgroundQuery = True
- .RefreshStyle = xlInsertDeleteCells
- .SavePassword = True
- .SaveData = True
- .AdjustColumnWidth = True
- .RefreshPeriod = 0
- .PreserveColumnInfo = True
- .Refresh BackgroundQuery:=False
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
¦^´_ Min
½Ð°Ýª©¥D¡A§A¥Îªº¬Omysql¡A¤p§Ì¬O«üsql server
¤p§Ìªº¥D¾÷¡Gtest
±b¸¹¡Gabc
±K½X¡G12 ...
joey0415 µoªí©ó 2010/6/30 12:32 AM
1.
sql server connection½d¨Ò¦p¤U
Cnnl.Open "Provider=MSIDXS.1; Data Source=path to file Indexing Service"
2.
SQL ½Ð±z¬Ý²Ä¤Q¦æ~
3.
¦Ü©óSQLªºªøµu...
¤£À´±zªº·N«ä!
¦pªG¬O«ü queroªº¸ê®Æ ¨º¶ëÃzexcel¨S°ÝÃD.. ¦ý¶ëÃz¦]¸Ó¨S¦³·N¸q... ©Ò¥H¦]¸Ó¬O¥u¯à©ñ65535*255!
¨º¦pªG±z«üªº¬OsqlÅÜ¼Æ ªøµu°ÝÃD.. ¨º¥i¥H¬d¤@¤Ustring¤W~ |
|
Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I
Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I
|
|
|
|
|
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
¦^´_ 8# Min
½Ð°Ýª©¥D¡A§A¥Îªº¬Omysql¡A¤p§Ì¬O«üsql server
¤p§Ìªº¥D¾÷¡Gtest
±b¸¹¡Gabc
±K½X¡G123
¸ê®Æ®w¡Gstock
°²³]¤p§Ì¬d¸ß¬O¬Y¸ê®Æªí¦p¡Gdbo.stockname
¤p§Ìªº»y¥y¬O¡Gselect * from dbo.stockname
½Ð°Ý«ç»òקï©O¡H
ÁÂÁª©¥DÀ°¤p§Ì¤@¨B¨B°£¿ù¡A½Ð°Ý¤@¤U¦pªG¥Îª©¥Dªº¼gªk¡A¨ºsql»y¥yªºªøµu´N¤£·|¨î¤F¶Ü¡H- Sub ADO_QueryTable()
- Dim Cnnl As New ADODB.Connection
- Dim Rst As New ADODB.Recordset
- Dim SQL As String
- Dim lCol As Long
- Dim lRow As Long
-
- Cnnl.Open "Driver={MySQL ODBC 3.51 Driver};Server=TEST;Port=3306;Database=TEST;CharSet=big5;Uid=TEST;Pwd=TEST;Option=16387" '³s±µSystem
- SQL = "SELECT COL0,COL1,COL2,COL3,COL4,COL5 FROM TABLE"
- Rst.Open SQL, Cnnl, adOpenKeyset, adLockOptimistic
- Do Until Rst.EOF
- For lCol = 0 To Rst.Fields.Count - 1
- Cells(lRow, lCol + 1).Value = Rst(lCol)
- Next
- lRow = lRow + 1
- Rst.MoveNext
- Loop
-
- Set Cnnl = Nothing
- Set Rst = Nothing
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
|
Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I
Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I
|
|
|
|
|
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
¦^´_ 6# Min
·|¤£·|¬O±zqueryªºvalue¤Ó¤j ©Ò¥Hcommandtext©ñ¤£¤U
¤p§Ì¤]ı±o¬O¦p¦¹¡A¦ý¬O¤p§Ì¤£·|§ï¡A½Ð¶{¤jÀ°¦£
ÁÂÁÂ |
|
|
|
|
|
|
- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
ssql = ""
ssql = ssql & vbCrLf & "select a.*,b.*,c.*,d.*"
ssql = ssql & vbCrLf & "from dbo.Stock a"
ssql = ssql & vbCrLf & "left join dbo.CreditExchange b on a.sdate=b.sdate and a.stockid=b.stockid"
ssql = ssql & vbCrLf & "left join dbo.NLDL c on a.sdate=c.sdate and a.stockid=c.stockid"
ssql = ssql & vbCrLf & "left join dbo.CompTrade d on a.sdate=d.sdate and a.stockid=d.stockid"
ssql = ssql & vbCrLf & "where a.stockid>1000 and a.sdate>='2010-06-09' "
ssql = ssql & vbCrLf & "order by a.stockid,a.sdate"
§ï¥Î³o¼Ëªº¤è¦¡ ¬Ý°_¨Ó¤ñ¸û¾ã»ô³á...
èè¤p§Ì¬Ý¤F¦Ñ¥b¤Ñ¡Aµo²{.... ·|¤£·|¬O±zqueryªºvalue¤Ó¤j ©Ò¥Hcommandtext©ñ¤£¤U... |
|
Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I
Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I
|
|
|
|
|
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
¦^´_ 4# Min
³oÓÀÉ®×¥»¨Ó«Ü¤j¡A§Ú§R¤F«Ü¦hÄæ¡A¥u«O¯d«e±´XÄæ»Pªø«×¡A½ÐÀ°§Ú¬Ý¬Ý
ÁÂÁª©¥D
8888.zip (364.28 KB)
|
|
|
|
|
|
|
- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
¤p§Ì¶K»yªk®É¡A¨ä¹ê¬O¦³&¡A¦ý¬O³Ì«á¨Ã¨S¦³¥X²{¡A½Ðmin¤j¤jÀ°§Ú¬Ý¤@¤U¡A¶]¥X¨ÓªºÏ¿ªG¦p¤U¹Ï
joey0415 µoªí©ó 2010/6/28 05:49 PM
³Ò¾r±NÀÉ®×PO¤W¨Ó~ |
|
Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I
Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I
|
|
|
|
|
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
±zªºsql¦r¦ê¥Î¿ù¤F! ¤Ö¤F&
¿ù»~
ssql = ssql "select a.*,b.*,c.*,d.* from dbo.Stock a" & Chr(13)
¥¿ ...
Min µoªí©ó 2010-6-27 21:46
¤p§Ì¶K»yªk®É¡A¨ä¹ê¬O¦³&¡A¦ý¬O³Ì«á¨Ã¨S¦³¥X²{¡A½Ðmin¤j¤jÀ°§Ú¬Ý¤@¤U¡A¶]¥X¨ÓªºÏ¿ªG¦p¤U¹Ï
|
|
|
|
|
|
|
- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
±zªºsql¦r¦ê¥Î¿ù¤F! ¤Ö¤F&
¿ù»~
ssql = ssql "select a.*,b.*,c.*,d.* from dbo.Stock a" & Chr(13)
¥¿½T
ssql = ssql & "select a.*,b.*,c.*,d.* from dbo.Stock a" & Chr(13)
¥þ³¡³£¦³¤Ö³á~ |
|
Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I
Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I
|
|
|
|
|