INFO: Reusing ADO Recordsets Maintains Properties (195512)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Data Access Components 2.1 SP2
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
This article was previously published under Q195512 SUMMARY
When you create a Recordset object without an active command, the recordset
remains empty until it is associated with one. Therefore, it is possible to
create a Recordset object at any point in a procedure, but not populate it
until necessary.
This makes it possible to create a recordset and then associate it with an
active command based on user input. The developer does not have to create a
recordset for each possible scenario.
Another benefit is that you can close and reopen the recordset as needed
without re-creating it. For example, you can close a recordset and then
reopen it, as needed, using a modified command. It is less expensive in
terms of performance to modify a recordset without recreating it because
the application is not required to reprocess all the information that
defines a recordset.
The example in the MORE INFORMATION section demonstrates setting several
properties of a recordset, performing a query, reusing the recordset to
perform a query on a different table, and displaying the properties, to
demonstrate that the Recordset properties are not altered by reuse.
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbDatabase kbinfo kbSQLProg KB195512 |
---|
|