LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Toolkit and stored procedures

Hi

I am having trouble to get the return values from a stored procedure (MS SQL Server 7.0) in CVI 6.0. My toolkit version is 2.04. I only get value 0 back. I read through the pdf manual a couple of times, but still does not understand where the problem can be. I has also tried DBRefreshParams() and DbSetParamChar(), but then I got an error when I try DBExecutePreparedSQL().

I have attached my stored procedure (procedure.txt) and my C function to call this procedure (function.c).

Please, if you know anything about the toolkit and using stored procedures let me know. I am grateful for any suggestions.

Regards
Peder Olav
Download All
0 Kudos
Message 1 of 5
(4,303 Views)
Peder,
I looked at the code, but was unable to run it because of the values from the .uir are used in the code, and that was not attached. I looked at the stored procedure, and everything in the text file looks alright. When you say ou get a 0 back, do you mean from the DBExecutePreparedSQL(handleProcedure)?
I understand why you would then make a call to DBRefreshParams() or the like, but what error message do you then get back from DBExecutePreparedSQL? Some ODBC servers do not support DBRefreshParams

Daniel McChane
Application Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,302 Views)
Hi Daniel

In my database I have, e.g. XNumber = xxx, ProductName = sa22, and ProductId = 862.
When I say I get 0 back, I mean when I watch retParam or outParam. I used the code below.
Status = DBGetParamInt (handleProcedure, 1, &retParam);
Status = DBGetParamInt (handleProcedure, 4, &outParam);
I thought that at least one of them should return 862, if I used the example values.
I do not get any error message, when I run the code I have in the previous attached file (function.c).

I get an error when I replace DBCreateParamInt() with DBRefreshParams() and execute DBExecutePreparedSQL(). Does not MS ODBC server supports DBRefreshParams() ?
I attached the error message.

So my problem is when I want to get the ProductId back. I am not able to
use DBRefresParams() and when I try DBCreateParamInt() and DBGetParamInt() I get no error message, but the value is 0 even if it is another value in the database.

Please can you help me with this.
We have used the database and the stored procedures together with Borland Builder C++ and then we get the right values back.

Peder Olav
0 Kudos
Message 3 of 5
(4,302 Views)
I am having the exact same problem! I'm using Microsoft SQL Server. I'm also getting 0 as a return value no matter what the real value is.
0 Kudos
Message 4 of 5
(4,283 Views)
Hello Scott,

Could you post you code, so I can take a look at it.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 5
(4,267 Views)