RegisterDatabase Method
Enters connection information for an ODBC data source in the Windows Registry. The ODBC driver needs connection information when the ODBC data source is opened during a session.
Syntax
DBEngine.RegisterDatabase dbname, driver, silent, attributes
The RegisterDatabase method syntax has these parts.
Part | Description |
---|---|
dbname | A String that is the name used in the OpenDatabase method. It refers to a block of descriptive information about the data source. For example, if the data source is an ODBC remote database, it could be the name of the server. |
driver | A String that is the name of the ODBC driver. This isn't the name of the ODBC driver DLL file. For example, SQL Server is a driver name, but SQLSRVR.dll is the name of a DLL file. You must have ODBC and the appropriate driver already installed. |
silent | A Boolean that is True if you don't want to display the ODBC driver dialog boxes that prompt for driver-specific information; or False if you want to display the ODBC driver dialog boxes. If silent is True, attributes must contain all the necessary driver-specific information or the dialog boxes are displayed anyway. |
attributes | A String that is a list of keywords to be added to the Windows Registry. The keywords are in a carriage-return–delimited string. |
Remarks
If the database is already registered (connection information is already entered) in the Windows Registry when you use the RegisterDatabase method, the connection information is updated.
If the RegisterDatabase method fails for any reason, no changes are made to the Windows Registry, and an error occurs.
For more information about ODBC drivers such as SQL Server, see the Help file provided with the driver.
You should use the ODBC Data Sources dialog box in the Control Panel to add new data sources, or to make changes to existing entries. However, if you use the RegisterDatabase method, you should set the silent option to True.