Solved

Store Procedure Error

Posted on 2006-06-13
3
299 Views
Last Modified: 2010-04-17
Why am I getting this error:
"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."

At this line:
cmd.Parameters.Append cmd.CreateParameter("PID", adInteger, adParamInput)
   


SP+++++++++++++++++++++++++++++++++
CREATE procedure sp_GetProduct
@PID int
AS
Begin
   select * from products where productid = @PID

end

GO


ASP++++++++++++++++++++++++++++++++++++++++++++
Set conn = Server.CreateObject("ADODB.Connection")
   conn.Open "XXX", "XXX", "XXXXXXXX"
   Set cmd = Server.CreateObject("ADODB.Command")
   Set cmd.ActiveConnection =conn
   Const adCmdStoredProc = 4
   cmd.Parameters.Append cmd.CreateParameter("PID", adInteger, adParamInput)  
   cmd("PID") = 100
   cmd.Execute
0
Comment
Question by:webdork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16895627
Set conn = Server.CreateObject("ADODB.Connection")

   conn.Open "XXX", "XXX", "XXXXXXXX"
   Set cmd = Server.CreateObject("ADODB.Command")
   Set cmd.ActiveConnection =conn
   Const adCmdStoredProc = 4
set p = cmd.CreateParameter("PID", adInteger, adParamInput)  
   cmd.Parameters.Append   p

p.value = 100
   cmd.Execute
0
 

Author Comment

by:webdork
ID: 16895628
Revised ASP code still error  

ASP++++++++++++++++++++++++++++++++++++++++++++
Set conn = Server.CreateObject("ADODB.Connection")
   conn.Open "XXX", "XXX", "XXXXXXXX"
   Set cmd = Server.CreateObject("ADODB.Command")
   Set cmd.ActiveConnection =conn
   Const adCmdStoredProc = 4
   cmd.CommandText = " sp_GetProduct "
   cmd.CommandType = adCmdStoredProc
   cmd.Parameters.Append cmd.CreateParameter("PID", adInteger, adParamInput)  
   cmd("PID") = 100
   cmd.Execute
0
 
LVL 2

Accepted Solution

by:
homemade earned 500 total points
ID: 16898589
Are you including adovbs.inc or defining adInteger and adParamInput elsewhere in your code?
If not that could be the problem.

If your not using adovbs.inc here are the constants defined:

'---- ParameterDirectionEnum Values ----
   Const adParamInput = &H0001

   '---- DataTypeEnum Values ----
   Const adInteger = 3
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question