1.

Solve : Classic ASP: error '800a000d' Type mismatch?

Answer»

Hello

I have a SIMPLE log-in form with four fields and the server gives me the FOLLOWING error:

Quote

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "maria"]'

/schoolsReg/Login.asp, line 23

'maria' refers to my chosen password.

Line 23 is this: if username = "" or password or fullname or strEmail = "" then

strEmail corresponds to the email column in my MS Access 2003 database.

The rest of my CODE looks like this:

Code: [Select]<%
username = ""
password = ""
ErrorMessage = ""
strEmail = ""
fullname = ""

if request.form <> "" then
username = Request.Form("username")
password = Request.Form("password")
fullname = Request.Form("fullname")
strEmail = Request.Form("strEmail")

if username = "" or password or fullname or strEmail = "" then [color=red]<---- where the error occurs[/color]

ErrorMessage = "You must specify a username, password, your full name and email address."
else
set conn = Server.CreateObject("ADODB.Connection")

conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open("E:\myDatabase.mdb")

set rs = Server.CreateObject("ADODB.recordset")

rs.Open "Select * FROM Users WHERE strEmail = '" & username & "'" & fullname & "'", conn

if rs.EOF = false then
if rs.fields("password") = password then
Response.Redirect("Default.asp")
end if
end if
ErrorMessage = "Login failed"
end if
end if

if ErrorMessage <> "" then
response.write("<p>" & ErrorMessage & "</p>")
response.write("<p>Please correct the errors and TRY again.</p>")
end if
%>

<h1>Login</h1>
<form method="post" action="">
<fieldset>
<legend>Log In to Your Account</legend>
<ol>
<li>
<label>Username:</label>
<input type="text" id="username" name="username" />
</li>
<li>
<label>Password:</label>
<input type="password" id="password" name="password" />
</li>

<li>
<label>Full name:</label>
<input type="text" id="fullname" name="fullname" />
</li>

<li>
<label>Email:</label>
<input type="text" id="strEmail" name="strEmail" />
</li>

<li>
<p><input type="submit" value="Login" /></p>
</li>
</ol>
</fieldset>
</form>

</div>
</body>
</html>
What am I doing wrong, please?

High1Quote
Code: [Select] if username = "" or password or fullname or strEmail = "" then

Or cannot be used on two strings. You are missing ="" COMPARISONS for password and fullname.Hello mastermind

Many thanks for your reply.

So I would have to use if username = "" or password = "" then only?

How would I include 'fullname' and 'strEmail', if I may ask?

Thank you

High1I'll try using this (and abandon fullname as it's not really essential):

if username = "" or password = "" or strEmail = "" then

High1


Discussion

No Comment Found