I have a sp that has one input parameter (Piece char(7)) and one output
parameter (Cost )...the sp works fine but I can't figure out how to:
a) get the sp to run in ip
b) I really need the OUTPUT parameter
sp: PROCEDURE dbo.prGetPieceReprocCost (
@Piece char(7),
@Cost char(7) null output
)
Pretty complex sp to calc the cost.
Both Piece & Cost are in the main data source.
My code so far is:
function btnReproc::OnClick(eventObj)
{
//Retrieve the value of the field that you want to use as a parameter
//to the stored procedure.
var sPiece =
getNodeValue("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail/@Piece");
XDocument.UI.Alert(sPiece);
//Set the Command for the Query Adapter of the Data Source. Incorporate the
//parameter values that you want to use.
var retCost = 0
var strSQL = 'execute "prGetPieceReprocCost" ' + '"' + sPiece + '"' + '
,retCost output';
XDocument.UI.Alert(strSQL);
XDocument.QueryAdapter.Command = strSQL;
//Query the Data Source.
XDocument.Query();
and I get : Cannot use the OUTPUT option when passing a constant to a stored
procedure
_______________________________________________________
Patrick-after more research I understand that this is not possinle w/o using ADO...I still need an example of the ADO code...
_____________________________________________________
Here is the response I got on mSDN:
The Command property of the QueryAdapter is a string, not an object, which is
why you are getting the error, since the OUTPUT parameter cannot be returned.
You will not be able to retrieve an output value returned by a stored
procedure by using this Command property. You need to use the Command object
of ADODB (see
http://support.microsoft.com/?kbid=185125).
For JScript, you would have to instantiate a Command object like this:
var objCommand = new ActiveXObject("ADODB.Command");
Then set the ActiveConnection and fill the Parameters collection on the
Command object, call Execute on the Command object, close the connection,
refresh the Parameters collection, and then retrieve the value of the output
parameter.
---
___________________________________________________________________
I'm going to need a JScript example of this for sure...thanks
Brandt