Calling SQL 2005 Stored Procedure from Classic ASP

Posted on 2008-11-13
Last Modified: 2012-06-21
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



set objRS = nothing

Open in new window

Question by:hennessym
    LVL 8

    Accepted Solution

    Did you define adCmdStoredProc?  The definition is in (which you can download from if you don't already have it).
    LVL 11

    Expert Comment

    This should also work:
    cmd.CommandType = 4
    LVL 1

    Author Comment

    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?
    LVL 1

    Author Comment

    Nevermind, I just need to do this:
    cmd.Parameters.Append cmd.CreateParameter("@Email",adVarWChar,adParamInput,100)

    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

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

    729 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

    18 Experts available now in Live!

    Get 1:1 Help Now