Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Passing value to SQL Server Stored Procedure

Avatar

12-09-2008

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?



Example:

(in form.initialize event)

var filename = event.target.documentFileName

Numericfield1.rawValue = storedProc(fileName)

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

15-09-2008

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 + "'";

//app.alert(xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value);



//now connect to DB and get a record

xfa.sourceSet.DataConnection.open()

Avatar

Avatar
Level 1
mcapsi
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
mcapsi
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
mcapsi
Level 1

14-12-2012

Do you do this on F.initialize?  Thanks