determine last record in a recordset

I am using classic ASP.

I am looping through a recordset and I need to know when I have reached the last record.  

Is there an easy way to do this?  Like say use rs.EOF -1

Who is Participating?
pateljituConnect With a Mentor Commented:
Please give this script a try, not sure of what you need to achieve and example would be great, thanks:

do while not rs.EOF

if rs.EOF then response.Write("EOF true")
When I am getting data from a database I just use the microsoft tools to get the data and loop through the count that way.  Here is an example:
string SelectString = "SELECT NAME FROM PEOPLE WHERE NAME = 'Steve'";

SqlConnection SqlConnect = new SqlConnection(GetConnectString());
SqlDataAdapter da = new SqlDataAdapter(SelectString, SqlConnect);

DataSet ds = new DataSet();

DataTable dataTable = ds.Tables[0];
DataRow[] dataRow = dataTable.Select();

if (dataTable.Rows.Count > 0)
	for (int indx = 0; indx < dataTable.Rows.Count; indx++)
		string Name = dataRow[indx]["NAME"].ToString();

Open in new window

nickgross19Author Commented:
Can you do this stuff in classic ASP, I am not using
Yes, many of the SQL classes are in ASP.  I ported this code over from an original ASP project.
I also came across an example I used a few years ago about classic ASP and an Access Database.  I have attached the sources.  It is also in VB.  I used the

Do While not rsGuestbook.EOF

for testing the database records.  In the attached file I had to change the .asp files to aspx, or the website would not let me attach the zip file.  Let me know if you have any questions.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.