Visual Basic Concepts
The Data Environment designer provides an interactive, environment for creating programmatic data access. At design time, you set property values for Connection and Command objects, write code to respond to ActiveX® Data Object (ADO) events, execute commands, and create aggregates and hierarchies. You can also drag Data Environment objects onto forms or reports to create data-bound controls.
With the Data Environment designer, you can accomplish the following tasks:
- Add a Data Environment designer to a Visual Basic project.
- Create Connection objects.
- Create Command objects based on stored procedures, tables, views, synonyms, and SQL statements.
- Create hierarchies of commands based on a grouping of Command objects, or by relating one or more Command objects together.
- Write and run code for Connection and Recordset objects.
- Drag fields within a Command object from the Data Environment designer onto a Visual Basic form or the Data Report designer.
Differences Between the UserConnection and Data Environment Designers
The Data Environment designer provides a means to easily access data in your Visual Basic project. In previous releases, you used the ActiveX UserConnection designer to create Remote Data Objects (RDO) at . Now, you can create ADO objects at design time using the Data Environment designer. In addition to supporting all of the functionality of the , the Data Environment designer supports:
- Multiple Connection objects that allow you to access multiple data sources within a single Data Environment.
- Connection and Command objects that you can organize by either connection or object.
- OLE DB data sources, as well as ODBC data sources.
- Drag-and-drop functionality that allows you to drag fields and tables from your Data Environment designer onto a form or the Data Report ActiveX designer. Data-bound controls are automatically created on the form. You can also specify the default control type that is created.
- Execution of commands included in your Data Environment as programmatic methods.
- Programmatic access to a Data Environment that is bound to controls on a form without a variable reference, such as moving to a new record.
- The ability to relate Command objects to create a relation hierarchy, or to group Command objects to create a grouped hierarchy.
- The ability to create aggregates that automatically calculate values within any Command hierarchy.
- The ability to manually bind data-aware controls to Field objects within a Command object.
- The Data Environment extensibility object model, which allows you to create add-ins. These add-ins can programmatically manipulate any DataEnvironment object within a Visual Basic project.
Functionality Comparison: UserConnection designer vs. Data Environment designer
|UserConnection designer||Data Environment designer|
|Data Access exposed using…||Remote Data Objects (RDO).||ActiveX Data Objects (ADO).|
|Objects exposed include...||only one RDO connection with multiple queries.||multiple ADO Connection and Command objects within one DataEnvironment object.|
|Events exposed include...||only events from the UserConnection object.||all ADO events for the Connection and Command object.|
|Direct data binding...||cannot be used as a direct data source.||can be directly bound to controls on a form.|
|Programmatic access exposes…||queries as methods from the UserConnection object with one ResultSet property.||Command objects as methods from the DataEnvironment object, with one RecordSet property per Command object.|
|Design environment provides…||a basic view that only displays the list of queries in the UserConnection.||two views of objects that list Connection and Command objects, as well as the Field objects returned from each Command object.|
- Designing a DataEnvironment Object
- Connection Objects
- Command Objects
- Field Mapping
- Manipulating Your Data Environment
- Attaching Code to ADO Events
- Using a Data Environment with Your Application
- Data Environment Programming Guidelines
- The Data Environment Extensibility Object Model
- Scenarios For Using the Data Environment Designer