Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 8

Manipulating a Recordset's Data With Its Methods (VB6)

The most direct manipulation of data with ADO takes place through the Recordset. The methods for ADO's Recordset object are basically the same as the methods for the Data Environment's or ADO Data Control's Recordset objects. You can therefore read the following sections on the specific Recordset methods and properties as applying to both the Recordset of ADO, and to the Recordset that belongs to the Data Environment and ADO Data Control.

One activity varies significantly between the two classes of Recordset, however: Notice that the technique for adding a record in ADO code significantly differs from the technique for adding a record for the Data Environment or ADO Data Control.

There is no design-time binding of controls to the data as there is with the Data Environment or the ADO Data Control. Because straight ADO objects lack this automatic binding of controls to data, the programmer must write code to refresh variables or userinterface controls whenever any action happens that would move the record pointer or otherwise change the contents of the fields.

Similarly, the programmer must explicitly move data from controls or variables to the record buffer whenever data should be saved.

Because a data access program must perform these two tasks so often, it is most efficient for the programmer to provide one general routine to read data from the record buffer into controls and another general routine to write data from controls into the record buffer.

The program can then call these routines whenever it needs to perform these tasks.

The following sections,

  • Referring to Recordset Field Contents

  • Programmatically Reading a Record into VB Controls

  • Programmatically Writing VB Controls to a Record

describe how you can write routines to manually refresh data in both directions (reading and writing) when you directly program ADO.

See Also


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved