用如下方法取历史数据,写到EXECEL做报表,但是每次执行时,需要很长的时间。请教各位高手,有没有解决的办法?
多谢了。
strQueryAvg = "Select DATETIME, VALUE, TAG FROM FIX " & _
"WHERE MODE = ‘AVERAGE‘ and (TAG=‘" & Tag1 & "‘ or TAG=‘" & Tag2 & "‘" & _
" or TAG=‘" & Tag3 & "‘ or TAG=‘" & Tag4 & "‘ or TAG=‘" & Tag5 & "‘" & _
" or TAG=‘" & Tag6 & "‘ or TAG=‘" & Tag7 & "‘ or TAG=‘" & Tag8 & "‘)" & _
"and INTERVAL = ‘01:00:00‘ and " & _
"(DATETIME >= {ts ‘" & StartTime & "‘} and " & _
"DATETIME <= {ts ‘" & EndTime & "‘})"
Dim cnADO As New ADODB.Connection
Dim rsADO As Recordset
Set cnADO = New ADODB.Connection
cnADO.ConnectionString = "DSN = FIX Dynamics Historical Data; UID = sa; PWD = ;"
cnADO.Open "FIX Dynamics Historical Data", "sa", ""
Set rsADO = New ADODB.Recordset
rsADO.Open strQueryAvg, cnADO, adOpenForwardOnly, adLockBatchOptimistic