Disconnected Recordsets

In the previous section, you learned how to create a recordset from scratch. This recordset had a structure custom-defined by you and was populated with data that did not come from a database. In other words, it was a disconnected recordset that was defined on the fly.

A disconnected recordset is a recordset that is not connected to a data source. A disconnected recordset can be defined programmatically (as you saw in Hands-On 16-1) or it can get its information from the data source (as shown in Hands-On 16-2).

Using disconnected recordsets allows you to connect to a database, retrieve some records, return the records to the client, and then disconnect from the database. By keeping your connection to a database open just long enough to obtain the required data, you can help conserve valuable server resources. You can work with the disconnected recordset offline and then connect to the database again to add your changes.

To get started using disconnected recordsets, perform Hands-On 16-2. The example procedure retrieves some data from the Orders table in the Northwind database, then disconnects from the database. While disconnected from the database, you manipulate and examine the content of the retrieved recordset.

0 0

Post a comment