Page

13.4.0- Summary

  by NT Community Manager.
Last Updated  by Jim Minatel.  

PublicCategorized as 13. Using Recordsets.

Not tagged.
<< 13.3.7- Arrays of RowsChapter13

Summary

We've covered an awful lot of ground in this chapter – looking at the most important aspects of the ADO Recordset object in the process. We've understood the concepts of a record, a field and a recordset in their broader senses, and seen how ADO models the recordset using a Recordset object. We can create a Recordset object using the Server.CreateObject method. One way of populating the recordset with data is to use its Open method – to connect it directly to a data store and grab some data. We've also seen much of the functionality that comes with an ADO recordset:

 

  • We use a cursor to find our way around the recordset. The cursor always points to one of the records in the recordset, and there are four different types of cursor. Some cursor types are more resource-hungry than others
  • A Recordset object can have one of four lock type settings. Our choice of lock type is dependent on whether or not we intend to change the data in the data store, on whether we want to see existing changes, and on the existence of other people using the data store. Some lock types are more resource-hungry than others
  • There are various methods that we can use to point the cursor at different records. For example, the Move, MoveFirst, MoveLast, MoveNext and MovePrevious methods allow us to move in forwards and backwards directions
  • The Find method allows us to search for a particular record that fits our criterion. If the search is successful, it points the cursor at that record (and if it fails, it points the cursor at BOF or EOF)
  • The Filter property allows us to hide all the records that don't specify a particular criterion
  • The Fields collection contains one Field object for each field in the recordset. We can use a loop to iterate through it in the same way as we iterate through any other collection
  • The GetRows method allows us to create an array containing data from the recordset

Along the way, we've seen that the ADO object model has an essentially flat hierarchy. We've also met the ADO constants, and seen that they can help us to create more readable code.

 

The Recordset is really at the heart of ADO, and as you use ASP more you'll probably discover you use it to do one main task – namely generating dynamic pages from a recordset. It's quite possible to create web sites that are almost entirely data bound, having only a few ASP pages – with all of the data generated from a data store using recordsets. Updating the site simply becomes a matter of updating the data store.  Obviously you won't be limited to this task, but you'll find that they can take away a lot of the effort involved in site maintenance.

 

In the next chapter we look at more advanced data handling techniques. For example, you'll find out how we go about updating the data store, or getting back information from data stores other than databases, and this will conclude our whistle-stop tour of ADO.

<< 13.3.7- Arrays of RowsChapter13

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |