Subject: Return a Record set into a table?
Posted By: morpheus Post Date: 11/17/2003 10:27:50 AM
If I am using a while wend loop to return only the records I want from the Database(MS Access) can I use those values to fill in a table.  Or do I have to use the The fields Collection.
I retrive the records I want with the below script, the connection and everything is already made.  But can I take those valuse and use them in a table.  Also I need it to display all records in the fields I want so if I add or delete it will change with the DB.  Any help would be great, Thanks!!!!

While Not objRecordset.EOF
    Response.Write objRecordset("ISBN")
 objRecordset.MoveNext
wend

Reply By: planoie Reply Date: 11/17/2003 10:38:51 AM
I just dumped this out of my head, but it should more or less work.

If Not objRecordset.EOF Then
    Response.Write("<table>")
    Response.Write("<tr>")
    For Each objField In objRecordset.Fields
        Response.Write("<td>" & objField.Name & "</td>")
    Next
    Response.Write("</tr>")
    While Not objRecordset.EOF
        Response.Write("<tr>")
        For Each objField In objRecordset.Fields
            Response.Write("<td>" & objRecordset(objField.Name) & "</td>")
        Next
        Response.Write("</tr>")
        objRecordset.MoveNext
    Wend
    Response.Write("</table>")
End If


Peter
------------------------------------------------------
Work smarter, not harder.
Reply By: morpheus Reply Date: 11/18/2003 10:38:18 AM
Thank you


Go to topic 6638

Return to index page 1003
Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997
Return to index page 996
Return to index page 995
Return to index page 994