|
本帖最后由 peterpu 于 2020-6-21 21:37 编辑
SQL查询结果添加新序号,请老师出手帮助,谢谢!
代码如下:
Sub 查询结果加序号()
Dim CNN As New ADODB.Connection
Dim Sj As New ADODB.Recordset
myData = ThisWorkbook.Path & "\" & 2956 & ".mdb"
With CNN: .Provider = "microsoft.jet.oledb.4.0":.Open myData:End With
SQL = "SELECT lc1.日期, lc1.收盘, lc1.五分钟 FROM lc1 WHERE lc1.时间=1500 AND lc1.日期>= #" & Sheet3.Range("I2") & "# and lc1.日期<= #" & Sheet3.Range("J2") & "# ORDER BY lc1.日期 asc"
Sj.Open SQL, CNN, adOpenKeyset, adLockOptimistic
arr00 = CNN.Execute(SQL).GetRows
MsgBox "内存数组 arr00 第一行添加新序号了吗?万分感谢!"
End Sub
|
|