Automating Database Printing |
BarTender documents can be designed to read data from one or more database connections such as text files or OLE DB and ODBC data sources. Database connection settings are configured by using the Databases collection object, which is a list of individual databases. Each Database object in the collection contains settings that are specific to the database type.
BarTender database connections can be controlled and modified by using ActiveX Automation. Many common methods for controlling database connections are supported, including the following:
Changing a Text File database connection's file name
Changing an OLE DB and ODBC SQL query statement
Setting query prompts that are defined on a document
The following example demonstrates how to set a Text File database connection's file name.
Custom SQL statements can be executed on a connected database to perform record filtering when data browsing or to select database records at print time. To apply a custom SQL statement, use the Database.SQLStatement property.
The following code demonstrates how to set a custom SQL statement.
A query prompt, which is defined as part of the attached database, is used to select which records are used when executing a print job. The Format object contains a list of all of the query prompts that are defined for a BarTender document. These are stored in the QueryPrompts collection object.
The following example demonstrates the use of query prompts via ActiveX Automation.
Related Topics