Re: Too many arguments in Stored Proc (VB6)



EdwardH wrote:
I am getting error message - "Procedure or Function zSpace has too
many arguments specified". Any comments gratefully received..

I have stored proc:
CREATE PROCEDURE dbo.zSpace @Wareh nvarchar(1)
AS

Nothing to do with your problem, but it is a good idea to start your
procedure by turning on nocount:

SET NOCOUNT ON

This will prevent informational "x rows effected" messages from interfering
with your ability to retrieve the result of your RETURN statement.


DECLARE @lWspace int
SELECT @lWspace=SUM(DISTINCT Height*Width*Depth)
from PartInvent
where ( Left(plocation,1) =@Wareh)
RETURN @lWspace
GO

and I am using VB6 Function to get total warehouse area:
Public Function GetTotal(ByVal sStoredProcName As String, sWare As
String) As Long
Dim oCmd As New ADODB.Command
Dim oParam As ADODB.Parameter
Set oCmd.ActiveConnection = invConn
oCmd.CommandText = sStoredProcName
oCmd.CommandType = adCmdStoredProc
oCmd.Parameters.Append oCmd.CreateParameter("Wareh", adChar,
adParamInput, 1, sWare)
oCmd.Parameters.Append oCmd.CreateParameter("RETURN_VALUE", adInteger,
adParamReturnValue)
oCmd.Execute
GetTotal = oCmd.Parameters("RETURN_VALUE")


Typically, the RETURN parameter needs to be appended first, before any of
the input or output parameters. Give that a try.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: DateTime Error :: Implicit Conversion
    ... > adDBTimeStamp, adParamInput, 8, DateAvailability) ... DateAvailability = CDate ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.db)
  • Variable not being passed to stored procedure or query
    ... classic ASP using VB6 and ADO and as part of this process reduced to ... Dim oCmd ... oCmd.Parameters.Append oCmd.CreateParameter("@ID", adInteger, ... adParamInput, 4, ID) ...
    (microsoft.public.vb.database.ado)
  • Re: Precision on Output Parameter
    ... Dim oCmd as New ADODB.Command ... oCmd.Parameters.Append oCmd.CreateParameter("Wareh",adChar, adParamInput, ... How do I set Precision ... Set param = .CreateParameter ...
    (microsoft.public.vb.database.ado)