Passing value to SQL Server Stored Procedure




I'm using LiveCycle Designer 8.2 and SQL Server 2005 Pro.

I have a form and made a connection to the database. I want to pass a value (the pdf filename) to the stored procedure and have the value returned from the stored procedure display in a numericfield (the return value is an integer). All I really need to know is: how can I pass values to the stored procedure from within the PDF?


(in form.initialize event)

var filename = event.target.documentFileName

Numericfield1.rawValue = storedProc(fileName)





To make a call to the database all of the information about that connection is stored in a structure called sourceSet. To be able to pass the filename into the SQL statement you must programatically adjust these parameters. Usually we set the data conection to be delayed open (so we can set the values) then open th econnection ourselves. Note you shoudl also close the connection when you are finished. Here is an example of how to access the parameters:

//set up sql call to DB to get specifics about employee

//Set the sourceSet to accept SQL commands

xfa.sourceSet.DataConnection.nodes.item(1).query.setAttribute("text", "commandType");

//set the SQL that you want to execute

xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value = "Select * from employees where EmpID = '" + EmpID.rawValue + "'";


//now connect to DB and get a record