Error in Parameters

I'm getting the following error when executing the the following asp code. Your help is highly appreciated.

ADODB.Parameters error '800a0e7c'

The application has improperly defined a Parameter object.

/Lab_Local/Lab/Login.asp, line 34

(I have marked line no 34 below)

    ' Verify the user and get user profile from sql server
      ' Create ADO connection
      Set cn = Server.CreateObject("ADODB.Connection")
      ' DSN is used to access sqlserver.
      cn.Open "DSN", "User", "Pwd"
      Set cmd = Server.CreateObject("ADODB.Command")
      cmd.ActiveConnection = cn
   ' Define the stored procedure's inputs and outputs
   ' Question marks act as placeholders for each parameter for the
   ' stored procedure  
    cmd.CommandText = "{call gsp_Login_1(?,?,?,?,?,?)}"
      cmd.CommandType = adCmdStoredProc
      ' Create input/output params
      Set CmdParam = cmd.CreateParameter ("UserID", adChar, adParamInput)
      cmd.Parameters.Append CmdParam <= this is "Line No 34"
      cmd.Parameters.Append cmd.CreateParameter("Password", adChar, adParamInput)
      cmd.Parameters.Append cmd.CreateParameter("VUser", adInteger, adParamOutput)
      cmd.Parameters.Append cmd.CreateParameter("LoggedIn", adInteger, adParamOutput)
      cmd.Parameters.Append cmd.CreateParameter("VersionNo", adInteger, adParamOutput)
      cmd.Parameters.Append cmd.CreateParameter("UserIPAddr", adChar, adParamInput)
      ' Set values for input params
      cmd.Parameters("UserId") = Request.Form("text_UserID")
      cmd.Parameters("Password") = Request.Form("text_Password")
      cmd.Parameters("UserIPAddr") = Request.ServerVariables("REMOTE_HOST") ' IP address
    ' do the work
    IF cmd("VUser") = 0 Then
            Response.Write "Invalid UserID/Password"
      Else ' Valid user
            IF cmd("LoggedIn") = 1 Then
                  Response.Write "User already logged in"
                  ' Valid user
                  Response.Write Redirect page...
            End If
      End If
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mm2Author Commented:
Edited text of question.
mm2Author Commented:
Edited text of question.
for creating parameters of character type, u need to specify an additional parameter (i.e. size ) to createparameter method.

add size parameter at the end of createparameter method as below

Set CmdParam = cmd.CreateParameter ("UserID", adChar, adParamInput , 30)
cmd.Parameters.Append CmdParam
cmd.Parameters.Append cmd.CreateParameter("Password", adChar, adParamInput, 30)
cmd.CreateParameter("UserIPAddr", adChar, adParamInput , 30)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed.  Also a question is posted there specific to these changes that apply to the experts here.  Also, I am including the link to our All Topics, since many new ones have recently been added.
Thank you,
Moderator @ Experts Exchange
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.