Recordset object property in ASP to browse through the records
We will learn how to collect data from an Access table and display them. We have seen before how to connect to Access table and how to open a recordset object. We will discuss here some methods and properties of recordset object to handle data.
While opening the recordset object we define different parameters and based on that we can handle the data collected by recordset object. Based on the query we apply our recordset object will fetch data for us. Recodset object maintain a pointer to this set of records and this pointer always points to one row or one record at a time. We can move to different locations in different directions by using methods associated with recordset object. We will try to understand some of the methods here.
This is a Boolean value that gets the value True if the record pointer is at the end of a set of records. This property is often used while displaying all records of the recordset object by looping through. Each time at the beginning of the loop EOF property is checked and record is displayed ( inside the loop ) if EOF is not true.
Like EOF (explained above )BOF gets TRUE value if recordset is pointing to the first record of the set of records the recordset object is having.
This moves the pointer by one step in forward direction. It will generate an error if record pointer is at the last record or the EOF property is true.
MovePrevious: This moves the recordset pointer by one step backward. This depends on the Cursourtype we declare at the time of opening the recodset object. We can't use MovePrevious for a forward-only cursor. MovePrevious will return error if BOF property is TRUE.
MoveFirst: With this we can move the pointer to beginning of the set of records.
MoveLast: Goes to the last record
Move number: Goes (or jumps) to the number of record from the current pointer position.
We will use all the above discussed properties to collect records and display them row wise in our next tutorial
Be the first to post comment on this article :