Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Parameter for Stored Procedure

Avatar

Former Community Member
How do you send a parameter to a stored procdure ?



In this case an integer (primary key) with MS SQL Server 2000 database



I was thinking a user filled Text Field and a button with delayed opening connection.



The rowset returned is name, address and few other bits of info for a standard letter. Is there a standard way of doing this?
2 Replies

Avatar

Former Community Member
I don't believe you can pass parameters to a stored procedure. I'm checking on this, but in the meantime, since you're passing a single integer parameter, a workaround would be to use an SQL statement to call the stored procedure.



When you create a data connection using SQL instead of a stored procedure, you can alter the SQL statement from script via:



$sourceSet.MyConnection.#command.query.select.nodes.item(0).value = "SELECT * FROM FOO";



where MyConnection is the name of your data connection.



I don't have an SQL Server instance handy to try this on but I believe using something like:



EXEC procname 123



So you'd use that in place of the "SELECT..." statement.



Let me know if this works for you.

--

SteveX

Adobe Systems

Avatar

Former Community Member
Thanks Steve



I adapted your thought to



"SELECT * FROM ufnPdfStdLetter(456)"



The ufn is a user defined function 456 comes from a text field it works fine.



I'm going to look up some ADO grammer re: command

$sourceSet.DataConnection.#command.query.commandType ="text"



I'll also try the execute command