将记录集转换为数组

Convert recordset into an array

我想将记录集 rs 转换为数组,以便我可以在进一步的代码中使用它。
rs 可以有可变行和可变列。

如果您使用的是 ADODB,它很简单:

Dim ret As Variant

ret = rs.GetRows '~~> assuming rs object is populated and set

Debug.Print Lbound(ret, 1), Ubound(ret, 1) '~~> bounds of 1st dimension
Debug.Print Lbound(ret, 2), Ubound(ret, 2) '~~> bounds of 2nd dimension