Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 17th, 2003, 11:27 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default Return a Record set into a table?

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

__________________
-----------------------------------------------------------
\"Don\'t follow someone who\'s not going anywhere\" John Mason
 
Old November 17th, 2003, 11:38 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
 
Old November 18th, 2003, 11:38 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you






Similar Threads
Thread Thread Starter Forum Replies Last Post
Return one record per value fizzerchris SQL Server 2005 4 August 17th, 2007 09:31 PM
Return a record that doesn't exist in a table? Unregistered SQL Server 2000 4 May 3rd, 2006 01:27 AM
return record count by quarter jtyson SQL Server 2000 1 June 29th, 2004 11:24 PM
Return the last record altered MikeJames42 VB How-To 1 February 13th, 2004 12:57 PM
Forms -- how to return to the same record and fiel tcarnahan Access 1 June 10th, 2003 11:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.