In previous tips, you've learned that when you use the ADO Connection object's Execute method to create a recordset, that recordset is a read-only, forward-only recordset. Here's an example:
Dim cnDB ' As ADODB.Connection
Dim rsData ' As ADODB.Recordset
Set cnDB = Server.CreateObject("ADODB.Connection")
cnDB.ConnectionString = "Provider=SQLOLEDB;" _
& "Data Source=(local);" _
& "Initial Catalog=Northwind;" _
& "User ID=sa;" _
& "Password=;"
cnDB.Open
Set rsData = cnDB.Execute("SELECT * FROM Customers")
The forward-only recordset is the most efficient type of recordset when you simply need to read data from the database. It doesn't include all the overhead of a static recordset, but it doesn't allow you to manipulate the records with methods other than MoveNext.
If you are using other types of recordsets and want to be consistent with how you open your recordsets, you can open a forward-only recordset using the Open method, as shown here:
Set rsData = Server.CreateObject("ADODB.Recordset")
rsData.Open "SELECT * FROM Customers", cnDB, adOpenForwardOnly
This constant is available as long as you've either included adovbs.inc in your file or you've referenced the ADO library using a METADATA tag, as I've shown in previous tips.