stored procedures output parameters

Results 1 to 2 of 2

Thread: stored procedures output parameters

  1. #1
    Join Date
    Dec 1969

    Default stored procedures output parameters

    Hi,<BR><BR>I&#039;m having trouble in WSH accessing an output parameter from a stored procedure - the code I am using is below, is there anything obviously wrong I am doing? Do I need to append each parameter instead of using the refresh method? The sp has 2 parameters, the first is input, the second output. When I assign the output param to a variable it is always null.<BR><BR>var oCommand = WScript.CreateObject("ADODB.Command");<BR>oCommand .ActiveConnection = sSQLConn;<BR>oCommand.CommandText = "uspAddUser"<BR>oCommand.CommandType = 4;<BR>oCommand.Parameters.Refresh();<BR>oCommand.P arameters(1).Value = "test"; //input parameter<BR>oCommand.Execute;<BR>var iOutput = oCommand.Parameters(2).Value //this is always null<BR><BR>Thanks,<BR>Bob<BR>

  2. #2
    Join Date
    Dec 1969

    Default When using the command obj, I usually

    append the parameters, however I noticed you put this<BR><BR>iOutput = oCommand.Parameters(2).Value <BR><BR>for your second parameter.<BR><BR>Well the collection is zero-based so this should really be <BR><BR>iOutput = oCommand.Parameters(1)<BR><BR>for the 2nd parameter and obviously the first would be Parameters(0).<BR><BR>Hope that helps<BR><BR>Pete<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts