Menu

Database

Database



Database is a very powerful tool for automation labels printing. To get connected to the database you must properly type the ADO connection string with all the necessary parameters. If you have difficulties with the string you may use the internal Windows tools. For this, click the "Select Data Source" button (see the picture below).

database data source params



Database connection Tutorial

Let’s suppose we have to link the simple database file to the label. We choose the CSV format as a database, it is a text format with the ";" fields separator symbol. Why CSV? Just because it is easy to operate and you don't have to install additional software, DMS, etc. Actually, the choice of formats is not limited and you may use various databases such as the DBF, Excel, MSSQL, Paradox, Interbase, Oracle, Access, etc. formats; this list may be limited only by the drivers installed on your computer.

You can download the CSV file which we will use in the further explanation here. See the picture below:

barcode label database

This text file is a table with products we need to print.

Code Barcode Title Price Qty
1001 406082190213 Monitor US $99.95 2
1002 406071237498 Mobile phone US $49.00 5
1003 406075813897 CD-DVD US $135.00 3
1004 406075812332 Keyboard US $15.99 4


Create a label to display these data (you can download it here).

barcode label



Select a data source

Select necessary objects
select the label objects

Click the "Data source" button as shown in the picture below. Thus, we will set the same data source for all the selected objects.
select a data source

Then the window where you will have to select "Database" and click the "Select Data Source" button will be displayed. You will see the window like the one below.
select an ADO data source

You should keep in mind that the picture in different Windows versions may vary but the main idea is the same.

You can use this database connection window in different ways depending on different conditions. We will follow one of them. Let’s use the connection string. For this, click the "Build..." button. In the appeared "Select Data Source" window, go to the "Machine Data Source" tab and click the "New..." button.
select ADO driver

Then select "Microsoft Text Driver (*.txt; *.csv)" in the driver list and click the "Next" button
database SQL query

In the data source parameters we will specify its name - "LABELDS" and the folder with the "items.txt" text file, in this case it is "С:\".
database file source

So we will get the string to get connected to the data source. Then you should write the SQL query to the data source. You can learn how to write SQL queries in special books or manuals on SQL. For example, to get all the database table records you should write the following query:
SELECT * FROM table_name

In our case the filename "items.txt" will be used as a table name. This done we will get the connection ready in full
database source connection string

You can check whether the connection works properly clicking the "Check connection" button. Press "Ok" if everything is right.



Linking object properties to the table fields

After the data source for objects is set you should link the label objects to the corresponding data source field. For this, you should select the object and specify a field for it as shown below
link the objects to the data source fields



Number of labels

We haven’t yet used the "Qty" field. This field contains the number of labels of each type to be printed. In order to specify this number you should specify the same data source (the items.txt file) for the label and link its "Number" property to the "Qty" field as before
link the label object to the data source fields



You can view the result of the whole work in the preview (the menu option File - Print Preview) and if you want you can print it. You can download the ready label (with the linked fields) here.

barcode label preview


See also