I have a recordset containing 3 records. I am using DO While loop in classic ASP in order to display all the records but the code below only shows the last record in the recordset.
<%Do While Not RS.EOF%>
<div><%=RS.Fields("ID").value%></div>
<div><%=RS.Fields("Title").value%></div>
<div><%=RS.Fields("Description").value%></div>
<%RS.MoveNext()
Loop%>
Can anyone tell me why that is happening? Is it something about the way I fill the recordset?
I know for sure it contains 3 records as RS.RecordCount returns 3.
Here is a code I use to create a dummy recordset and fill it with data:
With RS.Fields
.Append "ID", adBSTR
.Append "Title", adBSTR
.Append "Description", adBSTR
End With
With RS
.AddNew
.Fields("ID")="1111"
.Fields("Title") = "Test1"
.Fields("Description") = "Test Description 1"
.Update
End With
With RS
.AddNew
.Fields("ID")="2222"
.Fields("Title") = "Test2"
.Fields("Description") = "Test Description 2"
.Update
End With
With RS
.AddNew
.Fields("ID")="3333"
.Fields("Title") = "Test3"
.Fields("Description") = "Test Description 3"
.Update
End With