Solved

Store Procedure Error

Posted on 2006-06-13
3
300 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

624 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