From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
The connection string to be used to establish a connection to an ODBC database. The connection string can either contain only the DSN name, or a string containing one or more keywords defined for the driver.
If only the DSN is passed, then the UserName and Password properties are used for the connection. If the connection string contains keywords, then the UserName and Password properties are ignored. See your driver documentation for information about which keywords are supported.
Pass an empty string ("") to the DataSource property to get an open-file dialog box. It will prompt you to choose a list of defined DSNs. The DataSource property may be updated by the ODBC driver with additional parameters used after a connection is made.
For examples of connection strings for various databases, visit http://www.connectionstrings.com.
This example prompts the user to select a Data Source:
db.DataSource = ""
// proceed with database operations
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
This example specifies the DSN information to connect to a Microsoft Access database: