Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

Calling SQL 2005 Stored Procedure from Classic ASP

The following code is generating an error (Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another) on cmd.CommandType = adCmdStoredProc.

Any idea what I'm doing wrong?

Thanks in advance.


set objConn = server.CreateObject("ADODB.Connection")
objConn.Open objDBConn
 
Set cmd = Server.CreateObject("ADODB.Command")
   cmd.CommandType = adCmdStoredProc
   cmd.ActiveConnection =objConn
   cmd.CommandText = "dbo.sp_User"   
   
strEmail = Trim(Request("strEmail"))
 
cmd.Parameters.Append cmd.CreateParameter("@Email",adWChar, 1)
   
cmd("@Email") = strEmail
 
set objRS = cmd.Execute
if not objRS.EOF then
	arrUser = objRS.GetRows()
	strUserUbound = UBound(arrUser,2)
end if
 
objRS.close
set objRS = nothing

Open in new window

0
hennessym
Asked:
hennessym
  • 2
1 Solution
 
mkosbieCommented:
Did you define adCmdStoredProc?  The definition is in ADOVBS.inc (which you can download from http://www.4guysfromrolla.com/webtech/code/adovbs.txt if you don't already have it).
0
 
Louis01Commented:
This should also work:
cmd.CommandType = 4
0
 
hennessymAuthor Commented:
Thanks, mkosbie.  Now I'm getting this:
Parameter object is improperly defined. Inconsistent or incomplete information was provided.

on this line:
cmd.Parameters.Append cmd.CreateParameter("@Email",adWChar, 1)

Any thoughts?
0
 
hennessymAuthor Commented:
Nevermind, I just need to do this:
cmd.Parameters.Append cmd.CreateParameter("@Email",adVarWChar,adParamInput,100)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now