Hi,
In the access database I have a table called records with the following datum.
ID Name Username Password
1 Chris chris yeehaa
2 Dell dell dell
For some reason, this SQL query
rs.Open "SELECT Password FROM records WHERE Username='username'", conn
doesn't work from ASP but it works from SQL analyzer. Could someone tell me why? The following codes is from the whole asp page. Thanks in advance.
<%
username = request.form("username")
password = request.form("password")
correctpass = 0
Response.Write("Checking the access database for the password of username " & username & "<br>")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:/Inetpub/ set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT Password FROM records WHERE Username='username'", conn
do until rs.EOF
for each x in rs.Fields
if password = x then
correctpass = 1
end if
next
Response.Write("<br>")
rs.MoveNext
loop
rs.close
conn.close
if correctpass = 1 then
Response.Write("<br>Correct password</br>")
else
Response.Write("<br>wrong password</br> ")
end if
%>
In the access database I have a table called records with the following datum.
ID Name Username Password
1 Chris chris yeehaa
2 Dell dell dell
For some reason, this SQL query
rs.Open "SELECT Password FROM records WHERE Username='username'", conn
doesn't work from ASP but it works from SQL analyzer. Could someone tell me why? The following codes is from the whole asp page. Thanks in advance.
<%
username = request.form("username")
password = request.form("password")
correctpass = 0
Response.Write("Checking the access database for the password of username " & username & "<br>")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:/Inetpub/ set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT Password FROM records WHERE Username='username'", conn
do until rs.EOF
for each x in rs.Fields
if password = x then
correctpass = 1
end if
next
Response.Write("<br>")
rs.MoveNext
loop
rs.close
conn.close
if correctpass = 1 then
Response.Write("<br>Correct password</br>")
else
Response.Write("<br>wrong password</br> ")
end if
%>