Link to home
Start Free TrialLog in
Avatar of way_ching
way_ching

asked on

parameter not supplied for stored procedure

Hi

I have been fustrated by a stupid problem as stated in the title.

I did create the appropriate parameters in the Parameters collection and assign them values.

I looped thru the Parameters collection and make sure it matches the stored procedure input parameter list.

But when i execute  myCommand.Execute,  I keep getting an error saying that I did not supply a parameter which that sp expects.  

Can someone tell me what did i do wrong?

the following is the asp code:

Set spCmd = Server.CreateObject("ADODB.Command")
Set spCmd.ActiveConnection = conn2
spCmd.CommandType = adCmdStoredProc

spCmd.CommandText = "dbo.lsp_updateForm4"
spCmd.Parameters.Append spCmd.CreateParameter("transit", adVarchar, adParamInput, 10)
spCmd.Parameters.Append spCmd.CreateParameter("lineNum", adInteger, adParamInput)    
spCmd.Parameters.Append spCmd.CreateParameter("q3forecast", adDouble, adParamInput)    
spCmd.Parameters.Append spCmd.CreateParameter("q4estimate", adDouble, adParamInput)    
spCmd.Parameters.Append spCmd.CreateParameter("q1budget", adDouble, adParamInput)    
spCmd.Parameters.Append spCmd.CreateParameter("q2budget", adDouble, adParamInput)    
spCmd.Parameters.Append spCmd.CreateParameter("q3budget", adDouble, adParamInput)    
spCmd.Parameters.Append spCmd.CreateParameter("q4budget", adDouble, adParamInput)    

with spcmd
     .Parameters("transit") = "00000"
     .Parameters("lineNum") = 1
     .Parameters("q3forecast") = 100
     .Parameters("q4estimate") = 100
     .Parameters("q1budget") = 100    
     .Parameters("q2budget") = 100    
     .Parameters("q3budget") = 100          
     .Parameters("q4budget") = 100          
     .Execute
end with


And the procedure looks like this:

CREATE PROCEDURE dbo.lsp_updateForm4
     @transit nvarchar(10),
     @lineNum int,
     @lastyractual float = NULL,
     @q1actual float = NULL,
     @q2actual float = NULL,
     @q3forecast float,
     @q4estimate float,
     @q1budget     float,
     @q2budget     float,
     @q3budget     float,
     @q4budget     float
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, please maintain these open questions:
Auto-detection and removal of dead process on AIX Date: 10/04/2001 11:52PM PST
https://www.experts-exchange.com/questions/20191043/Auto-detection-and-removal-of-dead-process-on-AIX.html
Compressing data before saving to tapes when using Informix ontape command Date: 09/10/2001 02:39AM PST
https://www.experts-exchange.com/questions/20180843/Compressing-data-before-saving-to-tapes-when-using-Informix-ontape-command.html

Thanks,
Anthony
Avatar of way_ching
way_ching

ASKER

hi Anthony

Thanks for your answer.  :)
Just another quick question,  does the order of creating the parameters in ASP matter?  


THanks for reminding me about my open questions.  I already graded the answer.
>>Just another quick question,  does the order of creating the parameters in ASP matter?  <<
My understanding is that the order (and obviously type, length, direction, etc.) that the parameters are created is important, the names are not.  But I have never taken the time to prove that.

Anthony
Yep.  I just tested it.  The order does matter.
No wonder the application keeps giving me incorrect result.