I've searched through the Developer Zone and also searched www.ni.com for "stored procedure" and still having problems with retreiving an OUTPUT parameter from an SQL Stored Procedure Call.
I'd post the VI I'm working on but without the SQL database and specific procedure, it won't do much good. Suffice it say that the database is an corporate wide SQL database with validated procedures... so the problem is on my side with Labview.
Here's the sequence of operations I'm using in my VI:
1. Open a DB connection using the string name of the ODBC object.
2. Create Parameterized Query using an constant array of parameter clusters where each cluster has parameter name, parameter type enumer
ation, direction type enumeration, and variant. I type in a parameter names to match the parameters in the stored procedure (for example: @sint_status). I also select INPUT and OUTPUT direction types as appropriate and the proper data type (for example: LONG). The variant is left blank. The Query string is "call Method1(?, ?, ?, ?)" without the quotes.
3. Set all the INPUT parameters using the Set Parameter VI
4. Execute the Query using the Execute Query VI
5. Read the OUTPUT parameters using the Get Parameter VI
6. Free the command-record reference
7. Free the command reference
8. Close the DB connection
I know the Query runs OK because the Stored Procedure creates a new row in a database table with the correct values that I passed with the INPUT parameters.
However, the OUTPUT Parameter is ALWAYS zero! If I initialize the OUTPUT parameter using a Set Parameter VI before the Execute Query VI, then the parameter value after the query is always what I initia
lized before the query.
I'm really perplexed on this one.
Am I doing something stupid here?
Looking for feedback.
Thanks!
Jim