Copy and paste this code, change the string to the database, it should work without error.
<%
dim username, password
username=TRIM(Request("username"))
password=TRIM(Request("password"))
If username <> "" AND password <> "" then
Dim Con, sql, rec
set Con = Server.CreateObject("ADODB.Connection")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
'Select the record matching the username.
sql = "SELECT * FROM tblusers WHERE username='"& UCase(username) & "' AND password='" & UCase(password) & "'"
set rec=Con.execute(sql)
'If no match found, EOF is not true.
if NOT rec.EOF then
Response.Redirect("somepage.asp") 'Change to page redirect to after login
else
blankError="Invalid username." 'EOF is true, no match found.
end if
else
%>
<html>
<head>
<title>Login</title>
</head>
<body>
<form name="productForm" method="post" ID="Form1">
<center>
<table border="1" ID="Table1">
<tr>
<td colspan="2">
<%
if blankError<>"" then
Response.Write("<center>"&blankError&"</center>")
end if
%>
</td>
</tr>
<tr>
<td><Strong>Username:</Strong></td>
<td><input type="text" name="username" size="35" ID="Text1"></td>
</tr>
<tr>
<td><Strong>Password</Strong></td>
<td><input type="password" name="password" size="35" ID="Password1"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="loginButton" value="Login" ID="Submit1">
<input type="reset" name="reset" value="Clear" ID="Reset1"></td>
</tr>
</table>
</center>
</form>
</body>
</html>
<%end if%>
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429