LOTUS CONNECTORS

Examples: Connecting to an external database
1. This agent declares a new ODBCConnection object and displays the name of the available data sources. You must include the Uselsx "*LSXODBC" statement in the (Options) script of the agent.
2. This agent connects to a data source specified by the user. If the connection fails, IsConnected is False and the agent exits. (Alternatively, you can test the return value of ConnectTo, as shown in the code that is remarked out, rather than test IsConnected.) If the connection is good, the agent lists the tables for the data source by looping through the string array returned by ListTables, then disconnects before terminating.
3. This example is a form that contains two text fields named dataSource and Table, two buttons with the same names, and two actions named "List tables" and "List procedures." Notice the use of global declarations so that all the scripts on the form can access the same objects and the data. The form's Postopen script sets the objects, gets the names of the available data sources, writes the first one to the dataSource field, gets the names of the tables for the data source, and writes the first one to the Table field. The "Data source" button writes the name of the next data source to the dataSource field, gets the tables for the new data source, and writes the first one to the Table field. The "Table" button writes the name of the next table to the Table field. The "List fields" action displays the names of all the fields for the current data source and table. The "List procedures" action displays the name of all the procedures for the current data source.
See Also