Solved

Store Procedure Error

Posted on 2006-06-13
3
297 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

810 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