The RemoteData control is similar to the Visual Basic Data control in most respects. Both the Data control and the RemoteData control are designed to connect data-aware bound controls to a data source. The primary difference is that the RemoteData control uses RDO to connect to the ODBC driver manager, while the Data control uses DAO to connect to the Jet database engine, which can connect to native Jet databases or IISAM data sources. The Data control can also connect indirectly to RDO by using the ODBCDirect interface. Even though both controls use the same ODBC driver manager and data source entries, RDO, ODBCDirect, and DAO cannot share data source connections, data objects, or other resources.
Note The Data control supports the ability to use the RDO DLLs via the ODBCDirect option. In this case, your code uses Data Access Objects (DAO) instead of RDO to manage the Data control and its result sets.
Without a RemoteData control, a Data control, or its equivalent, data-aware (bound) controls can’t automatically access data. You can perform many simple remote data access operations using the RemoteData control without writing any code at all. However, most applications rely on additional RDO code to perform most data access operations, as RDO provides more flexibility and additional options not exposed by the RemoteData Control alone. In most respects, the RemoteData Control behaves very much like the Data control.
Data-aware controls bound to a RemoteData control automatically display data from one or more columns for the current row or, in some cases, for a set of rows on either side of the current row. The RemoteData control performs all operations on the current row.
If the RemoteData control is instructed to move to a different row, all bound controls automatically pass any changes to the RemoteData control to be saved by the ODBC data source. The RemoteData control then moves to the requested row and passes data back from the current row to the bound controls, where it is displayed.
The RemoteData control automatically handles a number of contingencies, including empty result sets, adding new rows, editing and updating existing rows, and handling some types of errors. However, in more sophisticated applications, you will need to trap some error conditions that the RemoteData control can’t handle. For example, if the remote server has a problem accessing the data source, doesn’t have permission, or can’t execute the query as coded, a trappable error results. If the error occurs before your application procedures start, or because of some internal errors, the RemoteData control's Error event is triggered.
The RemoteData control uses and creates the same RDO objects discussed in this chapter. When the appropriate RemoteData control properties are set, the RemoteData control can create an rdoResultset that can be manipulated in code like any other rdoResultset. You can also create an rdoResultset in code and set the RemoteData control’s Resultset property to point to this object.
Note To use the RemoteData control, you need to add it to the Visual Basic Toolbox. To add the RemoteData control to your Toolbox, click the Project menu, then click Components; in the Components dialog box, click the Controls tab and select the “Microsoft RemoteData Control 2.0” check box.
RDO is only supported on 32-bit operating systems (Windows 95 and Windows NT). To use the Remote Data Objects, you must set a reference to the Microsoft Remote Data Object 2.0 object library in the Visual Basic References dialog.