VB5, VB6Put It Out
With adoCommand
   .Parameters.Append .CreateParameter("RETURN_VALUE", _
      adInteger, adParamReturnValue, 0)
   .Parameters.Append .CreateParameter("@Zip", _
      adVarChar, adParamInput, 20, Null)
   .Parameters.Append .CreateParameter("@State", _
      adVarChar, adParamInputOutput, 2, Null)
   .Parameters.Append .CreateParameter("@City", _
      adVarChar, adParamInputOutput, 50, Null)

   .Parameters("@Zip") = Zip

   SQL = "usp_GetCityStateForZip"

   .CommandText = SQL
   .CommandType = adCmdStoredProc
   .ActiveConnection = "Pubs"
   .Execute

   'Check the return value after the update
   If .Parameters("RETURN_VALUE") = 0 Then _
      State = .Parameters("@State") & "
      City = .Parameters("@City") & "
   End If
End With
Listing 1 Use output parameters when a stored procedure returns a single value or row of values. Define the command parameters and specify them as output parameters. You can access the values from the Command object's Parameters collection after the stored procedure returns.