LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to link SQL server to Labview with Database Toolkit

Solved!
Go to solution

Appreciate for the detailed explanation. I completely got what you suggest to do. I think firstly I need to create a sensorid table to describe all 200 sensors and assign ID to each one. Now, my question is, still no clue at this point, how to WRITE such a vi to record the 3-column data.

 

Let's use your example, 2 sensors, 2 fieldpoint read.vi. Let's forget about shared variables and do everything in one loop. Could you please make a simple vi to achieve this? I guess we need to call the sensorid table at some point? How can I specify the sensor to the ID in the table (or vice versa) in the vi program?

0 Kudos
Message 21 of 23
(2,752 Views)

Unfortunately, I can't create such a VI because (a) I don't have Fieldpoint, and (b) I don't have the Database Toolkit. As far as the database stuff is concerned, if you choose to use a sensor table you can get the sensor ID by a SQL query via the "DB Tools Execute Query" VI. Your select statement would be something like this: "SELECT sensor_id FROM tblSensors WHERE ...". The WHERE clause would be where you would put in the conditions for a match (like module, channel, etc). I would get all the sensor IDs at the start of the program so you don't have to keep hammering the database asking for a sensor ID. Alternatively, you can simply fetch the entire table using "SELECT * FROM tblSensors" and use LabVIEW code to search for the IDs.

 

With respect to adding entries you would use "DB Tools Insert Data". The Database Toolkit ships with examples. Your best bet is to stufy these examples along with a test database and tables so you see how it works. 

0 Kudos
Message 22 of 23
(2,740 Views)
Thanks, I think the info should be sufficient for me to work on it. I will let you know any progress.
0 Kudos
Message 23 of 23
(2,731 Views)