Displaying Source Code(s)
|
|
ADO Techniques -- The .maxrecords property
--------------------------------------------------------------------------------
Description : This page demonstrates the capabilities how to
display a table from a SQL statement but limit the output to a
specific number of records.
<html><head>
<TITLE>dbmaxrecs.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<!--#INCLUDE VIRTUAL="/ADOVBS.INC" -->
<%
Set rstemp=Server.CreateObject("adodb.Recordset")
rstemp.maxrecords=15
connectme="DSN=Student;uid=student;pwd=magic"
rstemp.open "select * from titles", _
connectme,adopenstatic
' table display
howmanyfields=rstemp.fields.count -1
%>
<table border=1><tr>
<%
For i=0 To howmanyfields %>
<td><b><%=rstemp(i).name %></B></TD>
<% Next %>
</tr>
<%
Do While Not rstemp.eof %>
<tr>
<% For i = 0 To howmanyfields%>
<td valign=top><% = rstemp.fields(i).value %> </td>
<% Next %>
</tr>
<%
rstemp.movenext
Loop
rstemp.close
Set rstemp=Nothing
%>
</table></body></html>
|
|
|