Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Exercises - Page 13

November 27, 2000

These exercises use one or both of the two sample databases available from the Wrox Press website, at http://www.wrox.com/Books/Book_down.asp?section=11_3&isbn=1861002726&subject=&subject_id. Appendices A and B contain a description of the structure of (respectively) the Sailors database and the Clothier database.

  1. Use Sailor.mdb to create a list of sailors with one sailor per line (no table)
  2. Use Sailor.mdb to create a table of all of the boats.
  3. Use Sailor.mdb to make a list of the yacht clubs; not in a table but separated by horizontal lines.

Exercises - Answers

Note: answers are also presented in C01-Exercise.asp available from the WROX site.

1. Use Sailors.mdb to create a list of sailors with one sailor per line (no table).

<H1>Chapter 3 Simple Recordsets</h1>
<H3>Exercise 1 Use Sailors.mdb to create a list of sailors with
	one sailor per line</H3>
<%
dim oRSp
Set oRSp=server.CreateObject("ADODB.recordset")
oRSp.open "People", "DSN=sailors"
do while not oRSp.EOF
  Response.Write oRSp("PeopleNameFirst") & " "
  Response.Write oRSp("PeopleNameLast") & "<BR>"
  oRSp.movenext
loop
%>
[Note: the 2nd and 3rd lines above have been split for formatting purposes]

Example 6

2. Use Sailors.mdb to create a table of all of the boats.

<H1>Chapter 3 Simple Recordsets</h1>
<H3>Exercise 2 Use Sailors.mdb to create
	a table of all the boats</H3>
<TABLE BORDER="1">
<%
dim oRSb
Set oRSb=server.CreateObject("ADODB.recordset")
oRSb.open "Boats", "DSN=sailors"
do while not oRSb.EOF
  Response.Write "<TR><TD>" & oRSb("BoatName") & "</TD>"
  Response.Write "<TD>" & oRSb("BoatClass") & "</TD></TR>"
  oRSb.movenext
loop
oRSb.close
set oRSb=nothing
%>
</TABLE>
[Note: the 2nd and 3rd lines above have been split for formatting purposes]

Example 7

3. Use Sailors.mdb to make a list of the yacht clubs; not in a table but separated by horizontal lines.

<H1>Chapter 3 Simple Recordsets</h1>
<H3>Exercise 3 Use Sailors.mdb to make a list
	of the yacht clubs; not in a table</H3>
<%
dim oRSyc
Set oRSyc=server.CreateObject("ADODB.recordset")
oRSyc.open "Clubs", "DSN=sailors"
do while not oRSyc.EOF
  Response.Write "<hr>" & oRSyc("ClubName") & "</TD>"
  oRSyc.movenext
loop
Response.Write "<hr>"
oRSyc.close
set oRSyc=nothing
%>
[Note: the 2nd and 3rd lines above have been split for formatting purposes]

Example 8

A Trap With Recordsets and Tables - Page 12
Beginning ASP Databases
Chapter Three Quiz - Page 14


Up to => Home / Authoring / ASP / BeginningASPDatabases




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers