MoveNext 方法

将游标移动到下一个记录。

语法

Object.MoveNext()

参数 - Object必需。始终为 ADODB RecordSet 对象的名称

注释

以下示例说明了 MoveNext 方法的用法。

示例 1:

'Create ADODB.Connection Object
Dim ConnObj   ' Create a variable.
Set ConnObj = CreateObject("ADODB.Connection")
ConnObj.Open("ConnectionString") 'Creates DB Connection by Using Connection String

Dim RecSetObj
Dim CmdTxt
CmdTxt = "SELECT * FROM EMPLOYEE_DETAILS"
Set RecSetObj = ConnObj.Execute(CmdTxt) 'Returns RecordSet

Do Until RecSetObj.Eof
'Get the Value of Columns by using Column Index or Column Name based on Use Case
RecSetObj.MoveNext() 'Move cursor to next record
Loop

RecSetObj.Close()
ConnObj.Close()
Set RecSetObj = Nothing
Set ConnObj = Nothing