ASP error BOF, EOF

They have: 105 posts

Joined: Mar 2006

What does this error mean? I have changed it so that it gets the user information using userId, but when I click on the user name to view their details I get this error but when I change it back to using the username in the userId page it works, why is this?

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/user_details.asp, line 0

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

It's not being set to a record in the recordset. Something went wrong when you changed it to work with userid instead of username. Try putting [incode]recordsetname.movefirst[/incode] before accessing the record. If that doesn't work, could you post the code so we can have a look? Smiling

a Padded Cell our articles site!

They have: 105 posts

Joined: Mar 2006

I tried using recordsetname.movefirst before accessing the user information but I get a timed out error and it displays the first user in the database in a list. (not sure if I put it in the right place)

Here is the code:

At the start of the website (login page) it assigns the following:

SLQ connection details etc
SQLtemp = "SELECT * FROM password WHERE user = '" & Request.form("login") & "' "

So it's using the username submitted in the login field from the previous page,

It then assigns the following for the different access levels

dim username
username = rs("user") <--------- this is the email field in the database, I want to use the userId field which is called 'nr' for some reason! (Assume I have changed this to nr)

dim friendlyname
friendlyname = rs("name")

dim admin
admin = rs("admin")

Then it assigns these to cookies

response.cookies("passes") = username
response.cookies("passes2") = friendlyname
response.cookies("passes3") = admin

And checks that the username and password matches,

If Request.Form("login") = rs("user") AND Request.Form("password") = rs("pass") Then

(When I change rs("user") to ("nr") it doesn't work)

Browse Users Page

At the top of the browse users page is the following:

<?php
username
= request.cookies("passes")
?>

<?php
admin
= request.cookies("passes3")
?>

<?php
friendlyname
= request.cookies("passes2")
?>

<?php
If request.cookies("passes") = "" then response.redirect ("login.asp")
?>

The username = request.cookies("passes") holds the user which was assinged in the login page above, so if I changed user to nr in the login page passes would be nr,

The code for displaying the list of users:

SLQ Connection information etc
while not rs.eof%>

<?php
=rs("nr")
?>
<?php
=rs("nr")
?>
">
<?php
=rs("name")
?>
<?php
=rs("user")
?>
">
<?php
=rs("surname")
?>
<?php
=rs("house")
?>

<?php
rs
.MoveNext
Wend
rs
.Close
Apples
.Close
set Apples
= Nothing
?>

The code highlighted in red is used to access the user details page with the userId, nr (userId has been used here) When I click on this I get the BOF or EOF error and it can't find the record.

The code on the user details page is as follows:

The cookies at the top

<?php
username
= request.cookies("passes")
?>

<?php
admin
= request.cookies("passes3")
?>

<?php
friendlyname
= request.cookies("passes2")
?>

<?php
If request.cookies("passes") = "" then response.redirect ("login.asp")
?>

SQLtemp = "SELECT * FROM password WHERE user = '" & Request.Querystring("user") & "' "

Set rs = Apples.Execute(SQLtemp)

<?php
=rs("name")
?>
 
<?php
=rs("surname")
?>

<?php
=rs("location")
?>
 
<?php
=rs("country")
?>
etc

<?php
rs
.MoveNext
rs
.Close
Apples
.Close
set Apples
= Nothing
?>

If I change WHERE user = Request.Querystring("user") to WHERE nr = request.Querystring("nr") to match the previous page this also doesn't work,

Have you got any ideas? any help will be appreciated!

They have: 105 posts

Joined: Mar 2006

The other error that I get when I change some of the code is

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

user_details.asp, line 126

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Drew wrote: I tried using recordsetname.movefirst before accessing the user information but I get a timed out error and it displays the first user in the database in a list. (not sure if I put it in the right place)

That's really worrying, it shouldn't time out!

Just out of interest, what happens if you specify the fields to retrieve in your [incode]SELECT[/incode] statements? For example:
SQLtemp = "SELECT nr, user, admin, pass FROM password WHERE user = '" & Request.form("login") & "' "'
Change all the sql queries to do this, but don't change anything else. See if that still causes an error. If not, try changing the list of users to work with [incode]nr[/incode] instead of [incode]user[/incode].

You should also change:
while not rs.eof'
to
while not rs.bof or rs.eof'
This will make sure it's not at beginning of file when looping. If you find the loop isn't executed at all: you'll need an [incode]rs.movefirst[/incode] before entering the loop.

Give that a try, let us know how you get on. Smiling

a Padded Cell our articles site!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.