Using Store Procedure for User Authentication

Asked

Viewed 81 times

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")?

  • Diego, that’s already on the 3rd line after "include file".

  • We’re missing the set in front

  • Thank you! From that point passed, now you are unable to add the Parameters:

  • Make the mistake or it’s hard to help

  • Provider error '80020005' Type Mismatch. /login/Checkusersp.Asp, line 58

  • Row 58: cmd.Parameters.Append(cmd.Createparameter("@user","@pass"))

  • Parameter creation follows the following form: cmd.Parameters.Append cmd.Createparameter("Retval", adInteger, _ adParamReturnValue)

  • 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

  • Because yours is not integer. Put the type referring to what is in the comic

  • 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

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.