I am trying to make a simple login script with the names and passes stored in an Acces 2000 database. It was working fine before, but now when I go to the page I get this:
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/auth.asp, line 15
Here is the code:
VB Code:
Set oConn = Server.CreateObject("ADODB.Connection")
oOOo--oOOo
__/\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP [email protected] [email protected] Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Well, when i use that line it works, but I can't log in. I'm not sure what I am doing wrong. I am typing the names and passes just like in the database. I attached all the .asp files and the database.
Alcohol & calculus don't mix.
Never drink & derive.
<%
Option Explicit
Dim oConn
Dim oRS
Dim sSQL
Dim sTitle
Dim sBody
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("logins.mdb"))
sSQL = "SELECT Name, Password FROM np where Name='" & Request.Form("Name") & "' and Password='" & Request.Form("Pass") & "'"
Set oRS = oConn.Execute(sSQL)
If Not (oRS.EOF And oRS.BOF) Then
sTitle = "Thanks for logging in"
sBody = "Now logged in!<br><br><a href='logout.asp'>Log Out</a>"
Else
sTitle = "Login Failed"
sBody = "Name and password do not match.<br>Please try again."
End If
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>
<html>
<head>
<title><%=sTitle%></title>
<style>
body {
font-family: verdana, arial, helvetica;
font-size: 12px;
}
</style>
</head>
<body>
<%=sBody%>
</body>
</html>
No need to loop through the database. That would take too much time if you had alot of users. Just retrieve the records if they match. And if you have a match, then they are in.
oOOo--oOOo
__/\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP [email protected] [email protected] Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..