Visual Basic Concepts
This section contains information on viewing objects within your Data Environment designer, modifying and deleting objects, refreshing Command and Connection objects, and setting Data Environment designer options.
The Data Environment designer window has an outline view that shows the defined Connection and Command objects. This outline view can be arranged either by object type or by connection. You can also set this outline view to either display or hide the field objects of each Command object.
By Connection displays the objects grouped by connection, with the Command objects listed under the Connection object to which they are linked. Thus, you can easily view the association of Command objects with Connection objects. All defined Command hierarchies retain their structure.
To view By Connection
Outline View By Connection
By Object groups objects of the same type together. This enables you to focus on objects of a specific type, regardless of their associated connection.
To view By Object
Outline View By Object
By default, the Field objects of each Command object display in the outline view of the Data Environment designer. You can expand or collapse the view of these Field objects by clicking the plus (+) or minus (-) bitmap associated with the Command object. However, you can hide all Field objects completely from the outline view to clearly view relationships between Command objects.
To hide the Field objects for all Command objects
You can modify any existing Command or Connection object by accessing either its Properties dialog box or the Visual Basic Properties window. Common modifications include changing a Command object's connection source, adjusting a Connection object's logon information, and renaming an object.
Note While using the Visual Basic Properties window provides a direct means of changing individual property values, it can be more difficult if you are unfamiliar with the properties associated with the object.
To modify an existing Command or Connection object using its Properties dialog box
-or-
Double-click your Command or Connection object to open its Properties dialog box.
Note When the source of a Command object is changed, the Data Environment updates its associated field and parameter information.
To modify an existing Command or Connection object using the Visual Basic Properties window
Upon creation, objects in your Data Environment designer are given default names, such as Command1, Connection1, or DataEnvironment1. However, you can change these to more meaningful, unique names. For example, if you are creating a connection based on the Northwind database, a logical name may be "Northwind." Likewise, if you are creating a command based on the customer's table, a logical name may be "Customers."
Note When a Connection object is renamed, any Command objects associated with it automatically update in the ActiveConnectionName property. In addition, when a Command object is renamed, its link to the Connection object and other Command objects is maintained.
To rename an object in your Data Environment designer
-or-
Right-click the Command or Connection object you wish to rename and choose Rename from the shortcut menu. The outline view is now in edit mode. Type the new name, and then press ENTER to accept the change.
-or-
On the Visual Basic Properties window, select the entry to the right of (Name), and type the new name.
You can remove DataEnvironment, Connection, or Command objects from your Data Environment designer. When deleting an object, a warning message appears, unless Prompt before deleting objects is cleared in the Options dialog box. In addition, if the object selected for deletion has dependent objects, a message appears, asking if you also want to delete the dependent objects. For example, a Connection object has dependent objects if it is associated with a Command object, or a Command object has dependent objects if it is involved in a relation or grouping hierarchy.
Caution Once a Connection object is deleted, any Command objects associated with it become invalid, and the ActiveConnectionName property for all its associated Command objects is cleared.
To delete a Command or Connection object from your Data Environment designer
-or-
Right-click the Command or Connection object that you wish to remove and choose Delete from the shortcut menu.
The Refresh function differs in function between Connection and Command objects.
When a refresh is performed on a Connection object, the connection is closed and the internal cache is cleared of the metadata associated with the Connection object. In addition, refreshing a Connection forces the Data Environment to open the connection. After the refresh, the next time a list of tables or stored procedures is accessed, the list is rebuilt.
Note Refreshing a Connection object does not automatically refresh its associated Command objects.
When a refresh is performed on a Command object, all metadata stored with the object, including the Field and Parameter objects, is rebuilt. If the Command object's definition of the table or stored procedure has changed, the changes are reflected in the Command object after the refresh.
Caution Refreshing a Command object removes user-defined data, including parameter and field mapping information. Once removed, it cannot be retrieved.
To refresh a Connection or Command object
-or-
Right-click the Command or Connection object to refresh, and choose Refresh from the shortcut menu.
Connection and Command objects are also refreshed whenever their respective source properties are modified.
Note The status bar text indicates whether a Connection object is open (connected).
You can change the display of warning and confirmation dialog boxes using the Options dialog box.
To change warning and confirmation dialog box display
-or-
Right-click a DataEnvironment object and choose Options from the shortcut menu.
Item | Description |
Prompt before deleting object | When selected, a confirmation dialog box displays when you delete an object.
Note It is recommended that this option remain selected, so that the system presents an alert when deletion of an object affects other objects within your Data Environment. |
Disable Warnings | When not selected, warning messages appear when appropriate. |
Prompt before executing command | When selected, the system prompts you before executing a Command object.
Occasionally it is not possible for the Data Environment to obtain field information about a Command object from the data provider using its normal processes. When the Data Environment is unsuccessful in obtaining metadata about the Recordset of a particular Command object, it attempts to obtain this information from the data provider by executing the Command object. Thus, your permission is requested before the Data Environment executes the user-defined code. Note This situation generally only occurs for Command objects based on stored procedures or SQL text. |