Example Code

Changing the TestStand Database During a Single TestStand Execution

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Description

Overview

    This sequence file allows the user to modify the database the TestStand logs to during a single execution.

 

Description

      This sequence file overrides the LogtoDatabase sequence callback. It prompts the user to choose between two databases each time a UUT is tested. It either establishes a new connection to a new database or does not modify the database connection. 

 

Hardware and Software Requirements

TestStand 2014 or Compatible

 

Steps to Implement or Execute Code

 

  1. Open the attached sequence file in the TestStand Sequence Editor.
  2. Modify the connection strings so that they match the connection strings to your databases in the LogToDatabase sequence file. In order to obtain the connection string and create a new database:
    1. Navigate to Configure » Results Processing and check the box for "Show More Options" at the bottom of the dialog box that appears.
    2. Click Insert New...
    3. To add a new database to TestStand, click on the Log to Database option from the menu on the Insert New button. A new database will be added to your list in the dialog box, entitled "Database_2." You should have a default database, entitled "Database," in your list already.
    4. For each database, click the Options button for the properties dialog box to appear.
    5. Under the Data Link Options section, you can select your provider. Click Build on the lower right corner and dialog will appear for Data Link Properties.
    6. Select the database that you are using by selecting the name or the location of the database in the connection tab.
    7. Click OK. Repeat these steps for each of your databases.
  3. Once this is complete, the "Connection String Expression" field in the Database Options dialog will be populated with the connection string that you will need to insert into the LogToDatabse sequence file.
  4. Copy this connection string to the preconfigured local variables, Locals.ConnectionStr_DB1 and Locals.ConnectionStr_DB2,  in the LogtoDatabase sequence call.

Additional Information

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.