Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Command error- Parameter problems

Status
Not open for further replies.

moley

IS-IT--Management
Mar 26, 2002
95
GB
Hi,
I'm trying (badly) to create a few parameters to pass to a stored procedure (SQL7). The error i get is:

ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

The parameter is defined as follows:

adocmd.Parameters.Append adocmd.CreateParameter("login", _
adVarChar, adParamInput, 6, _
Request.Form("login"))

And the field is posted from the prev page

<input type=&quot;hidden&quot; name=&quot;login&quot; value=&quot;<%= login%>&quot;>

Has anyone any ideas to help as i think i'm going insane?????????

Thanks
 
try using:

objCM.Parameters.Append objCM.CreateParameter(&quot;@login&quot;, 200, &H0001, 6, Request.Form(&quot;login&quot;))

This creates a String (VarChar) parameter for a SP 6 characters long.

Use this in the SP

CREATE PROCEDURE MC_do_login

@login VarChar(6)

AS
Select .......
GO

Hope this helps


 
Thanks, but this still gives me the same error.

my sp look like this:

CREATE PROCEDURE spUpdateLeader
@login as varchar(6)


As
if exists (Select * From tblBaygroups
Where login = @login)

Begin
return (1)
End
else
Begin

INSERT INTO tblBayGroups(login)
VALUES (@login)
return (0)
end
GO

I caputure logon in the prev page from a querysting to a hidden field, do you think this may be a part of the problem????
 
Ensure that you are passing the login variable from the previous page - write it to screen - also what I find valuble when debugging stored procedures is to use SQL Server query analyser - type in the name of the SP and the login value and see what the SP returns - this will obviously let you know if your SP is working correctly.

Hope this helps.
 
mit99mh,

I get the test value for login writing fine above the error, and i've just tested the sp in SQL Server query analyser and the values returned are OK. Do you know if there is a numeric conversion in the post and collection i can specify???

 
It looks from your SP you are trying to return a value

I always specify a return parameter:

objCM.Parameters.Append objCM.CreateParameter(&quot;return&quot;, 3, &H0004, 4)

objCM.Execute
IsValid = objCM.Parameters(&quot;return&quot;).Value

Response.write IsValid

Hope this helps
 
I have specified return parameter and that parts fine, the code fails on the login appendparameter line, so i can only assume that the issue is with the login parameter!

I may have to admit defeat!!
 
does the login work when you use the query analyser?

I never use variables from the Request object.

I always assign them to asp variables.

Dim strLogin
strLogin = Trim(Request.Form(&quot;login&quot;))
'remove ws
I'd then check the login variable is correct eg not more than the correct number of characters..

if (Len(strLogin) <>6 )then

Response.write &quot;login to long / short&quot;
else
Response.write &quot;login to long / short&quot;
end if

Hope this helps

 
Cheers for the help. Finally works. More than 6 characters were passed in, although i dont quite know how. The trim didnt work but the LEFT did.

strLogin = Left(Request.Form(&quot;login&quot;),6)

Thanks again for the help, now I can sleep at night!!!

Cheers

Moley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top