LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling stored procedures with parameters with the Database Connectivity Toolkit

Solved!
Go to solution

I created a stored procedure on my machine just like yours using my own table.  Using the code below I got a value of 17 (verified in SSMS),  Did you modify the Create Parameterized Query VI as I originally stated in my first post?

 


 

 CREATE PROCEDURE getLastSequenceNumber
    -- Add the parameters for the stored procedure here
    @p1 nvarchar(10) = ''

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    SELECT max(pk_tporlog) from tporlog where cuserid = @p1;
END
GO


 

Example_VI.png

aputman
0 Kudos
Message 21 of 25
(2,057 Views)

I did not modify the Create Parameterized Query VI.  I just did and now it works!  Thanks so much for all the time and effort you put in to helping me, it is much appreciated and was a huge help.

0 Kudos
Message 22 of 25
(2,046 Views)

Attached is a VI that will:

 

(a) Open a connection to MS SQL Server database,

(b) Run a parameter laden stored procedure by name,  and

(c) Return results table if any w/column names.

 

Other features are:

 

1. Return second table of results (2nd table of results)

2. Execute Stored Procedure is a Global VI that can be run from anywhere (e.g. subVIs) in the code

 

For the connection string you can also use the SQL Native Client connectivity string:

Driver={SQL Server Native Client 11.0};Server=myServerAddress;
Database
=myDataBase;Uid=myUsername;Pwd=myPassword;

 

Be sure that you have installed the MS SQL Server native client driver ver: 11.

 

This one uses ADO (legacy).

 

See attached VI library.

 

Anthony Lukindo

Mezintel Inc.

Message 23 of 25
(1,816 Views)

Hello,

You can use this example which is tested.

0 Kudos
Message 24 of 25
(1,480 Views)