From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with an external SQL database

Solved!
Go to solution

Hello. First, I have never worked with, or know anything about the TestStand platform...please be gentle.  I have a relatively simple task to accomplish, but have no idea where to start.  The order of operations is as follows:

 

1. Operator scans a barcode (ID)

2. Pass the ID to an external SQL database using a stored procedure call

3. Receive the value returned from the SQL db

4. Flow control based on value returned

 

Seems simple enough, but the TS Sequence construction has me baffled.  How would one use the Open/Close/Data Operation commands to make this happen?  Steps 1 and 4 have been written and function properly.  My hangup is creating the sequence steps to accomplish this.

 

Open/Close Database works, but I cannot write an Open SQL Statement that will work.  Having said that....yes, the SQL db connection is good.  When I use the "Database Viewer" I can query to my hearts content, and the stored procedure call works as expected.  I'm in over my head here...again, I have no idea how to even manage variables or anything else in TS. I am a complete noob, and was asked to add this SQL check to an existing sequence.  Any help appreciated. Thanks!!

0 Kudos
Message 1 of 3
(2,100 Views)
Solution
Accepted by topic author Pork_Chop

Have you looked at the Database example that ships with TestStand yet?  C:\Users\Public\Documents\National Instruments\TestStand 2016 (32-bit)\Examples\Built-In Step Types\Database Step Types

 

It shows how to use the Database step types. 

 

Personally I'm not a fan of them.  I create a LabVIEW VI that does my DB communication.  Or you can call directly into .net assemblies from TestStand.

 

Local Variables would be the best options for passing information between steps that are in the same sequence.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 3
(2,070 Views)

Thanks jigg. It took a lot of trial and error, but I now have the SQL portion working as intended. Yes, I used Local Variables to do the passing, as you suggested, and it works like a charm. The biggest hurdle was for me to learn the lay of the land with TestStand. Thanks again!

0 Kudos
Message 3 of 3
(2,047 Views)