Error using the Command-object of ADO 
Author Message
 Error using the Command-object of ADO

Hi,

I have written the following code in ASP:

    Set objComm = Server.CreateObject("ADODB.Command")
    objComm.ActiveConnection = strConnection
    objComm.CommandText = "spStoredProc"
    objComm.CommandType = adCmdStoredProc
    objComm.Parameters.Append objComm.CreateParameter("UserID", adInteger, _
        adParamInput, , Request.Form("UserID"))
    objComm.Parameters.Append objComm.CreateParameter("RETURN_VALUE",
adInteger, _
        adParamReturnValue)
    objComm.Execute

The stored procedure spStoredProc has 1 input parameter and returns 1
returnvalue.

When I execute the ASP-page the following error occurs:

    Microsoft OLE DB Provider for SQL Server error '80040e14'
    Too many arguments were supplied for procedure spCreateTransaction.
    /asp/vehweb.asp, line 21 //* the objComm.Execute line

What is wrong?!?
Please help...

Thanks,
Jakob.



Mon, 10 Feb 2003 03:00:00 GMT  
 Error using the Command-object of ADO

Hi again!

I solved it myself. Apparently when you use a ReturnParameter that parameter
has to be the first one in the parameters collection.

Y/Jakob


Quote:
> Hi,

> I have written the following code in ASP:

>     Set objComm = Server.CreateObject("ADODB.Command")
>     objComm.ActiveConnection = strConnection
>     objComm.CommandText = "spStoredProc"
>     objComm.CommandType = adCmdStoredProc
>     objComm.Parameters.Append objComm.CreateParameter("UserID", adInteger,
_
>         adParamInput, , Request.Form("UserID"))
>     objComm.Parameters.Append objComm.CreateParameter("RETURN_VALUE",
> adInteger, _
>         adParamReturnValue)
>     objComm.Execute

> The stored procedure spStoredProc has 1 input parameter and returns 1
> returnvalue.

> When I execute the ASP-page the following error occurs:

>     Microsoft OLE DB Provider for SQL Server error '80040e14'
>     Too many arguments were supplied for procedure spCreateTransaction.
>     /asp/vehweb.asp, line 21 //* the objComm.Execute line

> What is wrong?!?
> Please help...

> Thanks,
> Jakob.



Tue, 11 Feb 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Error Using ADO Command object

2. Using the ADO Command Object to send an Execute command

3. ADO Command Object using Multiple Connection Objects

4. ADO: Using Command Object

5. Ado Command Object reports error

6. Problem using the ADO Command object

7. Using ADO Command object and Access PROCEDURE to insert Memo/Binary fields

8. ADO, Oracle, MTS, using command object to open Recordset

9. ADO Command Object Error 3711 Invalid Operation

10. Error using Command Object

11. ADO Command object and MSShape commands

12. Sending command to a FoxPro database using ADODB.Command Object

 

 
Powered by phpBB® Forum Software