Database ADO/ODBC page

dLabel includes the facility to read data from ADO/ODBC data sources, such as Microsoft Access, Excel, SQL Server and Oracle database, as well as simple text files.

To achieve this dLabel requires two “strings” used for the ODBC connection:

1) The Connection string - which specifies the source of the data, the driver file used to obtain the data, and any username and password required to access the data.

2) A Recordset string - which specifies which part of the data source (eg. table, worksheet, or query) is to provide the data.

The ADO/ODBC page contains a check box labelled “Use ADO/ODBC data source” which causes dLabel to attempt to use the data from this source - and load it automatically the next time the label template is opened, and two text boxes into which these string may be entered.

 

 

ODBC Connection strings are not always immediately obvious, so the page also includes a “Build” button, which, when pushed, displays a list of the ODBC data sources to which the user has access

 

 

Once a data source type has been selected and the OK button pushed one of several possible connection dialogs will be displayed, allowing the user to enter a username and password (if required) and to select the data source required - which may be an Access database file (*.mdb), and Excel file (*.xls) or a database on a database server as shown below.

 

 

Pushing the OK button on this dialog returns to the ADO/ODBC page with the appropriate connection string filled in.

The user now determines the Recordset string required, typically the name of a Table in a database, or the name of a worksheet in a spreadsheet, and an SQL SELECT command for selecting data from an SQL server.

While a straightforward process, there are a few points that should be noted for the syntax of the recordset string:

a) MS Access. When referring to a table or query name which contains spaces then name should be enclosed in quotes or square brackets. eg. “Employees details” or [Customer addresses]

b) Excel - When referring to a worksheet the sheetname should be enclosed in quotes or square brackets and should be terminated with a $ (don’t ask), eg. [Sheet1$]

c) SQL - SQL language should not be enclosed in quotes! eg. SELECT * FROM Products

Once the recordset string is entered pushing the Connect button will open the connection and transfer the data to dLabel. Note that the datasource is opened as Read-only.

 

More:

Database Editor dialog