Forums

ASP

This topic is locked

User Authentication Problems

Posted 12 Sep 2005 00:31:37
1
has voted
12 Sep 2005 00:31:37 Keji Adedeji posted:
Hi All,

Any help whatsoever will be truly appreciated!

i have created a login page linked to a login database. However, everytime I enter the correct login details, instead of directing me to the specified page for successful login, i receive the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/COPSNet/TMP5ozdzmncuk.asp, line 35

Here is the code I am using, line 35 is in red,i have checked the fields in the database, the username field is a numeric field and the password field is a text field, i have also tried it without the () at the end of line of line 35....to no avail....i have no clue where to go with this, for the sake of my fast moulting head (i dont wanna be a bald girl! hehe), HELP!

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Login.asp" -->
<%
Dim rsUser
Dim rsUser_numRows

Set rsUser = Server.CreateObject("ADODB.Recordset"
rsUser.ActiveConnection = MM_Login_STRING
rsUser.Source = "SELECT EmployeeID, Password FROM Login"
rsUser.CursorType = 0
rsUser.CursorLocation = 2
rsUser.LockType = 1
rsUser.Open()

rsUser_numRows = 0
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL"
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("username")
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="/activity.asp"
MM_redirectLoginFailed="/login failed.htm"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_Login_STRING
MM_rsUser.Source = "SELECT EmployeeID, Password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM Login WHERE EmployeeID='" & Replace(MM_valUsername,"'","''" &"' AND Password='" & Replace(Request.Form("password","'","''" & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open()
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username" = MM_valUsername
If (MM_fldUserAuthorization <> "" Then
Session("MM_UserAuthorization" = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization ).Value)
Else
Session("MM_UserAuthorization" = ""
End If
if CStr(Request.QueryString("accessdenied") <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied"
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>

thanks and regards to all


Replies

Replied 17 Sep 2005 12:16:33
17 Sep 2005 12:16:33 Dave Thomas replied:
i would have thought the username is passed as a string.

use your username box as a text field.

regards

Dave Thomas
<b>DMX Zone Manager</b>

Reply to this topic