Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Ado Recordset in ASP

Ado Recordset in ASP

ADO Recordset in Classic ASP is a key object used to hold the results of a query — basically, it represents a set of records (rows) returned from a database.


What is an ADO Recordset?

  • A container for rows and columns returned by a SQL query.

  • Allows navigation through rows (MoveNext, MoveFirst, etc.).

  • Lets you read or update data in the recordset.

  • Has properties like .EOF (end of file), .BOF (beginning of file), .Fields, .RecordCount.


Basic Example: Using ADO Recordset in ASP

<%Dim conn, rs, sql' Create and open connectionSet conn = Server.CreateObject("ADODB.Connection")conn.Open "Provider=SQLOLEDB;Data Source=SERVER;Initial Catalog=DB;User ID=USER;Password=PASS;"' SQL querysql = "SELECT UserID, Name, Email FROM Users"' Create Recordset object and open itSet rs = Server.CreateObject("ADODB.Recordset")rs.Open sql, conn, 1, 3 ' 1=adOpenKeyset, 3=adLockOptimistic' Check if there are recordsIf Not rs.EOF Then    Do Until rs.EOF        Response.Write "UserID: " & rs.Fields("UserID") & "<br>"        Response.Write "Name: " & rs.Fields("Name") & "<br>"        Response.Write "Email: " & rs.Fields("Email") & "<hr>"        rs.MoveNext    LoopElse    Response.Write "No records found."End If' Close recordset and connectionrs.CloseSet rs = Nothingconn.CloseSet conn = Nothing%>

Important Recordset Properties

PropertyMeaning
.EOFTrue if after last record
.BOFTrue if before first record
.RecordCountNumber of records in the recordset (may be -1 if unsupported)
.FieldsCollection of fields (columns) in current record

Important Recordset Methods

MethodPurpose
.OpenOpen recordset with SQL and connection
.CloseClose the recordset
.MoveNextMove to next record
.MovePreviousMove to previous record
.MoveFirstMove to first record
.MoveLastMove to last record

Notes

  • Use cursor and lock types to control behavior (e.g., adOpenForwardOnly, adLockReadOnly).

  • You can update data in a recordset if opened with a writable lock.

  • Always close and clean up objects to free resources.


Want me to show you how to add/update/delete records with Recordset, or how to use different cursor types?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql