0
I have the following Store Procedure
in my Mysql database, SP_Autentica
:
BEGIN
SET @id = (SELECT ID FROM userdata WHERE Username = user AND Password = pass);
END
In the ASP code, conn.asp
:
connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";PORT=" & db_port & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword & ";OPTION=" & db_option
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open connectstr
In the ASP code, CheckUser.asp
:
<!-- #include file="../assets/commonFiles/conn.asp" -->
varUsername = Request("Username")
varPassword = Request("Password")
cmd = Server.CreateObject("ADODB.Command")
cmd.CommandText = SP_Autentica
cmd.CommandType = 4
p = cmd.Parameters
p.Append(cmd.CreateParameter("@user","@pass"))
cmd("@user") = varUsername
cmd("@pass") = varPassword
cmd.ActiveConnection = Conn
cmd.Execute()
I would like to receive your reply SELECT
of Procedure
in a variable, when the user sends the parameters of user
and pass
. But I get the following error message:
Microsoft Vbscript Runtime error '800a01b6' Object doesn’t support this Property or method: 'cmd.Commandtext' /login/Checkusersp.Asp, line 55
Can someone help me?
Man, would you have to do
set cmd = Server.CreateObject("ADODB.Command")
?– Sorack
Diego, that’s already on the 3rd line after "include file".
– Leonardo Feijó
We’re missing the set in front
– Sorack
Thank you! From that point passed, now you are unable to add the Parameters:
– Leonardo Feijó
Make the mistake or it’s hard to help
– Sorack
Provider error '80020005' Type Mismatch. /login/Checkusersp.Asp, line 58
– Leonardo Feijó
Row 58: cmd.Parameters.Append(cmd.Createparameter("@user","@pass"))
– Leonardo Feijó
Parameter creation follows the following form: cmd.Parameters.Append cmd.Createparameter("Retval", adInteger, _ adParamReturnValue)
– Sorack
Changed now I got the following error: ADODB.Command error '800a0bb9' Arguments are of the Wrong type, are out of acceptable range, or are in Conflict with one Another. /login/Checkusersp.Asp, line 57
– Leonardo Feijó
Because yours is not integer. Put the type referring to what is in the comic
– Sorack
I changed it to: cmd.Parameters.Append(cmd.Createparameter("Retval", adVarChar, adParamReturnValue)) In my database there are two Varchar fields.. and I want to return a column Integer I get the error message: ADODB.Command error '800a0bb9' Arguments are of the Wrong type, are out of acceptable range, or are in Conflict with one Another. /login/Checkusersp.Asp, line 57
– Leonardo Feijó