Visual Basic Concepts

Initializing rdoEngine Default Properties

When you create new rdoEnvironment, rdoConnection, or rdoResultset objects, the characteristics of the new objects are determined by the arguments in the rdoCreateEnvironment or OpenResultset method, or by the default values in the default properties of the rdoEngine. These properties are listed in the following table.

Property Specifies Default
rdoDefaultCursorDriver Cursor library (ODBC, client batch, server-side, or none) rdUseIfNeeded (server-side cursors)
rdoDefaultPassword User password "" (empty string)
rdoDefaultUser User ID "" (empty string)
rdoDefaultErrorThreshold Error severity above which errors are fatal -1 (disabled)
rdoDefaultLoginTimeout Time to wait before abandoning connection attempt 15 seconds

You can change any of these default value properties before creating new rdoEnvironment, rdoConnection, or rdoResultset objects. However, rdoEnvironments(0) is created using the defaults shown in the preceding table because it is created automatically on the first reference to RDO or the RemoteData control. If the default values are not appropriate for your application, you must change the properties of rdoEnvironments(0) or the rdoEngine before creating a new rdoEnvironment object or opening a connection.

Trapping the InfoMessage Event

The rdoEngine fires the InfoMessage event when the ODBC interface receives an informational message from the remote server. This event is raised after RDO receives a SQL_SUCCESS_WITH_INFO return code and populates the rdoErrors collection with the informational messages. If an RDO method call generates many informational messages, this event will be raised only once, after the last informational message has been added to the collection. You can trap this event and examine the contents of the rdoErrors collection and then decide what action is appropriate.

For example, if you submit a query that enables statistics or query plan information from SQL Server, this information is returned through the rdoErrors collection, and your application is notified that these messages are available when the InfoMessage event is fired.