Accessing Data

See Also

Using the design tools and wizards, you can easily access data in Visual J++. By adding the WFC data controls to your form in the Forms Designer, you can quickly configure how data is retrieved and displayed. You can also run the Data Form Wizard to generate a data-bound form automatically.

Visual J++ provides controls to access data through ActiveX Data Objects (ADO), the data programming model for WFC applications. The core ADO objects include the Connection, Command, and Recordset objects, which allow you to connect to a database and retrieve a set of records. ADO also provides the DataSource component, which combines the functionality of the Connection, Command, and Recordset objects.

Note   The Toolbox in the Forms Designer provides only a DataSource control; the Connection, Command, and Recordset objects can be used only in code. For information about programming with the ADO objects, see the ADO Tutorial (VJ++).

ADO supports simple data binding through the DataBinder component. This component binds a field from a Recordset or DataSource component to the property of a WFC control. Visual J++ also provides complex data-bound controls, such as the DataGrid

and DataNavigator controls, that interact directly with a recordset. For more information about data binding, see Data Binding in WFC.

To access data on a form, you can either run the Data Form Wizard or perform the following steps in the Forms Designer:

For more information about ADO, see Getting Started with ADO 2.0. For information about the COM-based data access options available with Visual Studio, see Choosing the Right Data Access Technology.