MoveNext Record Set Function

MoveNext Record Set Function
When you're working with a set of records in ASP, you want some way to move from record to record. The MoveNext function lets you do that.

Let's say you select all writers from your database with a statement like

SQLText = "select FirstName, LastName from writers order by LastName, FirstName"

You go through all the defining and opening of your record set and now want to move by them one by one, to put each one on your screen. You would say:

do while not objRec3.EOF
response.write objRec3("firstname") & " " & objRec3("lastname") & "
"
objRec3.MoveNext()
loop

If you did NOT do the MoveNext, the record wouldn't move on to the next record. You would keep printing out the same record, over and over again, until your server went insane and locked up :)

Really, infinite loops are REALLY bad for your system. Make sure you always have your records advancing properly before you test out your code!




RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map





Content copyright © 2023 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.