我需要传递2个日期作为绑定变量。但是结果集仅打印第二个日期。如何为相同的参数“假期”传递两个日期
Sub Ora_Connection()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim query As String
Dim i As Integer
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
i = 2
strCon = "Provider=OraOLEDB.Oracle;Data Source=XXXX/YYY;User Id=XXXX;Password=YYYY"
con.Open (strCon)
Set Cm = New ADODB.Command
With Cm
.ActiveConnection = con
.CommandText = "SELECT COUNT(DATE_VALUE) FROM PAYOR_DW.DATE_DIMENSION
WHERE DATE_VALUE >= PAYOR_DW1.DATE_VALUE
AND DATE_VALUE < PAYOR_DW2.DATE_VALUE
AND IS_WEEKDAY = 'Y'
AND INSTR((:Holidays) ,DATE_VALUE,1,1)< 1 )AS 'TURNAROUND TIME'
FROM PAYOR_DW.CORRESPONDENCE_FACT CF "
.CommandType = adCmdText
Set Pm = .CreateParameter("Holidays", adDate, adParamInput)
.Parameters.Append Pm
Pm.Value = "18-FEB-19"
Set rs = .Execute
Pm.Value = "20-FEB-19"
Set rs = .Execute
End With
While Not rs.EOF
Sheet3.Cells(i, 1).Value = rs.Fields(1).Value
Sheet3.Cells(i, 2).Value = rs.Fields(2).Value
Sheet3.Cells(i, 3).Value = rs.Fields(10).Value
Sheet3.Cells(i, 4).Value = rs.Fields(4).Value
i = i + 1
rs.MoveNext
Wend
End Sub
感谢您的帮助