ADO Tutorial
This tutorial illustrates using the ADO programming model to query and update a data source. First, it describes the steps necessary to accomplish this task. Then, the tutorial is repeated in Microsoft® Visual J++®, featuring ADO for Windows Foundation Classes (ADO/WFC).
This tutorial is coded in different languages for two reasons:
- Some documentation for ADO assumes the reader codes in Visual Basic. This makes the documentation convenient for Visual Basic programmers, but less useful for programmers who use other languages.
- If you are uncertain about a particular ADO feature and you know a little of another language, you may be able to resolve your question by looking for the same feature expressed in another language.
How the Tutorial is Presented
This tutorial is based on the ADO programming model. It discusses each step of the programming model individually. In addition, it illustrates each step with a fragment of Visual Basic code. At the end, it restates and integrates the code fragments as a Visual Basic example.
The code example is repeated in other languages, however, without the discussion. Each step in a given programming language tutorial is marked with the corresponding step in the programming model and descriptive tutorial. Use the number of the step to refer to the discussion in the descriptive tutorial.
Because this tutorial consists of several small fragments of code, you cannot execute the code as written.
The ADO programming model is restated below. Use it as a roadmap as you proceed through the tutorial.
ADO Programming Model with Objects
- Make a connection to a data source (Connection). Optionally, begin a transaction.
- Optionally, create an object to represent an SQL command (Command).
- Optionally, specify columns, tables, and values in the SQL command as variable parameters (Parameter).
- Execute the command (Command, Connection, or Recordset).
- If the command is row-returning, store the rows in a storage object (Recordset).
- Optionally, create a view of the storage object so you can sort, filter, and navigate the data (Recordset).
- Edit the data, either adding, deleting, or changing rows and columns (Recordset).
- If appropriate, update the data source with changes from the storage object (Recordset).
- If a transaction was used, accept or reject the changes made during the transaction. End the transaction (Connection).
Next Step 1
© 1999 Microsoft Corporation. All rights reserved. Terms of use.