LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulling Multiple Store procedures

Solved!
Go to solution

*****WARNING*****  I am still trying to learn Labview as much as I can through the tutorials and various other modules. So my coding may still not be extrememly as effecient as it should be.  *****WARNING*****

 

 

First off, I am using Labview 2014. My question is, can I execute multiple Stored Procedures with the SQL VI that I am using? If not, how can I do so? I am doing the following steps:

1. Connect

2. Login

3. Execute one Stored Procedure

4. Get the Data String

5. Close connections.

 

I am doing this cycle about 25-30 times, every 2-3 minutes. The Stored Procedures take about 30-60 seconds to execute. I was wondering if I could do the following steps instead:

1. Connect

2. Login

3. Execute all of the Stored procedures

4. Get all of the Data Strings

5. Close connections.

 

If not, can you advise if there is a better way to do this?

 

 

A picture of what I am currently working with is attached...

 

Thanks Greatly...

0 Kudos
Message 1 of 15
(3,228 Views)

We'd like to help you.  One way to do that is to run your code, but you only sent us a picture of your code.  Many of us do not have time to recreate your code from a picture!

 

Please attach the VI itself, so we can open it, examine it, find/fix errrors (if there is a broken Run arrow, for example), etc.  Help us to help you.  Note that if you need to, you can attach a ZIP file with several VIs inside.

 

Bob Schor

0 Kudos
Message 2 of 15
(3,187 Views)

The problem is, I have to remove all server information because I am connecting to a corperate Server connection, before I send the VI. "Network security policies" That is why I only sent a picture. Would it be help still to send the VI without the Server information?

There is a sample VI. I have no errors with this setup, "BUT" that's only running 1 Stored Procedure. Can I take that setup and run multiple Stored Procedures with it??

Please advise...

0 Kudos
Message 3 of 15
(3,145 Views)
Why are you connecting and logging in each time? I think you have retrieve the data after calling a stored procedure but you can certainly connect and log in once to save time.
0 Kudos
Message 4 of 15
(3,125 Views)

The Stored procedures don't change, I have to run the same 20-30 stored procedures every 2 minutes. How can I do that with 1 login, connect and close?

Please advise

0 Kudos
Message 5 of 15
(3,106 Views)
Solution
Accepted by topic author NewerProductionDeveloper
Move your connect and login out of the case statement. Do it in your main and pass the reference to the subVI. If you are using a state machine, the connection/login would be a state called at the beginning and then you would have a close state when you stop the VI.
Message 6 of 15
(3,101 Views)

Only thing is, this VI runs 24/7

0 Kudos
Message 7 of 15
(3,091 Views)
And your point is what? Why would that change my suggestion?
0 Kudos
Message 8 of 15
(3,067 Views)

@Dennis_Knutson wrote:
Move your connect and login out of the case statement. Do it in your main and pass the reference to the subVI. If you are using a state machine, the connection/login would be a state called at the beginning and then you would have a close state when..........

This was the crux of Dennis' suggestion.  You can have the close state run whenever you need it, you don't need it to run only when the VI stops.

0 Kudos
Message 9 of 15
(3,058 Views)

I understood that, I was just making sure that I was on the same page. I am already looking to code it into the 2 minute refresh cycle. It has been running 20+ connection, login and close cycles every 2 min for almost 2 months now. All of a sudden our DBA's decided to pitch a fit about it. So I figured I could do that 1 close action every 2 minutes, they should be satisfied.

0 Kudos
Message 10 of 15
(3,046 Views)