在 VBA 编程中,我试图了解记录集在将数据从函数内传递到另一个记录集时的状态
例如
Sub Test()
Dim Recordset1 as new ABODB.Recordset
Set RecordSet1 = BringDataFromRecordset2()
Do while not Recordset1.EOF
'data do something
Recordset1.movenext
Loop
End Sub
Function BringDataFromRecordset2() as ADODB.Recordset
dim RecordSet2 as new ADODB.Recorset
RecordSet2.Open "Select * from DUAL", Connectionstring
BringDataFromRecordset2 = RecordSet2
End Function
RecordSet2 在“Set RecordSet1 = BringDataFromRecordset2() 行中将数据传递给 RecordSet1 时会发生什么?
它会自动关闭吗?如果 RecordSet2 仍然打开,我该如何关闭它?