Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old January 22nd, 2008, 04:38 PM
Authorized User
 
Join Date: Jan 2008
Location: kokomo, IN, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default creating table

Hello friends... :)

Can someone give me the quick and dirty of how to add a table so that my recordsets printout in a table?

<%
  Option Explicit
  Dim strConnect
%>

<!-- METADATA TYPE="typelib"
              FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<HTML>
<HEAD>
<TITLE>ADO Command Object</TITLE>
</HEAD>
<BODY>

<%
  Dim objCommand, objRS
  Set objCommand = Server.CreateObject("ADODB.Command") ' create the Command object

  ' fill in the command properties
  objCommand.ActiveConnection = strConnect
  objCommand.CommandText = "booyaa"
  objCommand.CommandType = adCmdTable

  ' now execute the command, and capture the selected records in a recordset
  Set objRS = objCommand.Execute

  ' The Command object has done its job, so clean it up
  Set objCommand = Nothing

  ' now loop through the records

  While Not objRS.EOF
   Response.Write objRS("Artist") & ": " & objRS("Album") & ": " & objRS("Year") & "<BR>"
   objRS.MoveNext
  Wend

  ' now close and clean up
  objRS.Close
  Set objRS = Nothing
%>
</BODY>
</HTML>

Do I add the tags inside the While loop? Thank you
__________________
keep your kneeze in the breeze
  #2 (permalink)  
Old January 22nd, 2008, 04:45 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You would do something like this:

Set objCommand = Nothing
' now loop through the records

%>
<table>
<%
 While Not objRS.EOF
%>
<tr>
   <td><%=objRS("Artist")%> </td>
   <td><%=objRS("Album")%> </td>
   <td><%=objRS("Year")%> </td>
</tr>
<%
   objRS.MoveNext
  Wend
%>
</table>

hth

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
  #3 (permalink)  
Old January 22nd, 2008, 05:00 PM
Authorized User
 
Join Date: Jan 2008
Location: kokomo, IN, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll tell you what Doug you are a machine! I have been messing with that for quite awhile, I thought I had it several times.

You make this stuff look easy... your code is clean and to the point. Thanks again for showing me the way.

I appreciate your help.
ph0neman

Last edited by ph0neman; April 14th, 2011 at 09:58 AM..
  #4 (permalink)  
Old January 22nd, 2008, 05:06 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hey no problem, glad it worked out for you! =]

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch. 4 -1. Creating a Table jfr BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 February 16th, 2005 02:26 PM
creating a table on server2 FALCONSEYE SQL Server 2000 3 January 26th, 2005 03:16 PM
Creating table with existing table without value kumar_kumar Oracle 1 January 4th, 2005 07:12 AM
Creating a medal table awood2000 XSLT 12 November 15th, 2004 07:26 AM





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