Problem With variables and forms
Hello, I wrote the following code:
<% @LANGUAGE=VBScript %>
<%
If Session("userName") = "" Then
Response.Redirect("default.asp")
End If
dim oConn, sqlText, oRSdb, theUser, oldPass, newPass1, newPass2
theUser = LCase(Request.Form("txtUserName"))
oldPass = Request.Form("txtUserPass")
newPass1 = Request.Form("newPass1")
newPass2 = Request.Form("newPass2")
Response.Write theUser & "<BR>" & oldPass & "<BR>" & newPass1 & "<BR>" & newPass2 & "<BR>"
sqlText = "SELECT * FROM USUARIOS WHERE usuario = '" & theUser & "' " & "AND senha = '" & oldPass & "';"
set oConn=Server.CreateObject("ADODB.connection")
oConn.open "DRIVER={SQL Server}; SERVER=msde20i.terraempresas.com.br; DSN=neumans; UID=neumans; PWD=q5r8f3b8"
Set oRSdb = Server.CreateObject("ADODB.Recordset")
oRSdb.Open sqlText, oConn
oRSdb.MoveFirst()
Dim theUserDB
theUserDB = LCase(oRSdb("usuario"))
Response.Write "The user is " & theUserDB
If theUser = theUserDB Then
Response.Write "OK."
Else
Response.Write "You have to find another solution..."
End If
%>
The problem is: I never get a successfull result when I compare the form user data with the sql database data. I'd like to get the "OK" response at the final and not "You have to find another solution...". I'd like to compare the variable that holds the form data and the variable that holds the db data and do some code forth, but they always don't be equal, even if I put all the correct data that I have in my db. Anyone can help me about this? Please, I'm almost crazy about...
|