Solved

Store Procedure Error

Posted on 2006-06-13
3
293 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
3 Comments
 
LVL 142

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now