Sequentially Reading and Displaying a Record from a Database Table

Updated Oct 10, 2018

Reported In

Software

  • LabVIEW Database Connectivity Toolkit
  • LabVIEW

Issue Details

I want to read every record from my database table and display it sequentially in a table indicator. Currently, I can display all the data at once using the Read All Data VI example from the LabVIEW Example Finder, but I need to find a way how to display each record one by one.



 

Solution

When displaying data using a table indicator, data must be in array format with each array element corresponding to a different column of the database table.

In the example code below, the DB Tools Move To Next Record VI function is used to iterate over each record in the database table. Every new record value is inserted to the array and stored to the shift register to update the table indicator.

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.



 

Additional Information

The Database Fetching VI example from the LabVIEW Example Finder also shows how to get every record from a database table.

Note: To establish connection to the desired database, a .udl file must be first selected.