Connecting to an external database
Create a new ODBCConnection object with "Dim New" or "Set = New." Once the object exists, you can get:
- Software revision string with the GetLSDOMasterRevision property
- Available data sources with the ListDataSources method
Connect to an external data source with the ConnectTo method of the ODBCConnection object. The external source must be defined in the ODBC Driver Manager at the operating system level. You can test the connection with the IsConnected method.
If the data source requires a user name and a password, you can supply these as arguments to ConnectTo or let the data source prompt the user. You can suppress prompts from the data source by setting the SilentMode property to True, although intermediate software may still prompt.
After you connect to a data source, you can query and update the external tables with the ODBCQuery and ODBCResultSet objects, and can get the following information:
- Name of the data source with the DataSourceName property
- Names of the tables for the data source with the ListTables method
- Names of the fields (columns) in a table with the ListFields method
- Names of the stored procedures for the data source with the ListProcedures method
- Status of options for the data source with the IsSupported method
When you are done using a data source to which you connected, disconnect from it with the Disconnect method.