Mapping Tag Values to SQL Values

I am trying to insert the values of some input fields into a SQL table via a Stored Procedure…

I keep getting “1st arg can’t be coerced” error, I am assuming I am running into an issue with the input values not being the same type as the SQL Fields they are going into…

Here is my call to the Stored Procedure

system.db.execSProcCall("EXEC Site.dbo.spSetTagValues @TagID = event.source.parent.getComponent('TagIDtxt').text @OrderNumber = event.source.parent.getComponent('OrdNumfld').intValue @LotNumber = event.source.parent.getComponent('LotNumtxt').text @Quantity = event.source.parent.getComponent('Qtyfld').intValue @ParentID = event.source.parent.getComponent('ParentIDtxt').text")
Name                    Ignition Data Type         SQL Data Type
TagIDtxt                Text                              NVARCHAR(50)  
OrdNumfld             Value (Integer)              INT
LotNumtxt             Text                              NVARCHAR(50)
Qtyfld                    Value (Integer)              INT
ParentIDtxt            Text                             NVARCHAR(50)

I am sure I am missing something simple, just need a pointer in the correct direction… Thanks

Hi tbackus,

You are using the system.db.execSProcCall function incorrectly. Before you can call a stored procedure with system.db.execSProcCall you have to create a stored procedure call context with system.db.createSProcCall. Have a look at the manual here: … occall.htm

It is also possible to call a stored procedure with the regular database functions such as system.db.runPrepUpdate.

Thanks nmudge. Was realizing that shortly after posting… I think I found my solution following those examples in the manual… Anotehr case of RTFM!! :blush: