Forum Moderators: open
<%
'Save entered username and password
Username = Request.Form("txtUsername")
Password = Request.Form("txtPassword")
RepeatPassword = Request.Form("txtRepeatPassword")
Fullname = Request.Form("txtFullname")
'Check if username and password are entered
if Username = "" then Response.redirect("index.asp?login=createnamefailed")
if Password = "" then Response.Redirect("index.asp?login=createpassfailed")
if Password <> RepeatPassword then Response.Redirect("index.asp?login=createpassfailed")
'Build connection
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("database.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
'Open all records
rs.Open "SELECT * FROM userlist", conn, 3, 3
'Check if username doesn't already exist
do while not rs.EOF
if rs("username")=Username then
set rs=nothing
set conn=nothing
Response.Redirect("index.asp?login=createnamefailed")
end if
rs.MoveNext
loop
'Add a record
'Put username and password in record
rs("Username")=Username
rs("Password")=Password
rs("Fullname")=Fullname
'Save record
rs.Update
set rs=nothing
set conn=nothing
Response.Redirect("index.asp?login=creatednew")
%>
During my trial, i got an error :
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Can you guys tell me whats wrong? It'll help a lot for me.
Usually it means you've run a query to the database where no records are returned or then tried to read from a recordset that contains no data.
I'd go check to make sure theres a record in the recordset before reading it in allow some fault tolerance for your application like 'If NOT rsRecordSet.EOF Then').
Hope that helps... ;)