asp page
Author: Qing Apple Computer Studio Click: 351
The first stop in this example is the ASP page. This ASP page is connected with ADO and Northwind database. In order to maintain a good coding habit, I
Option explicit was used and clearly declared all variables. The first draft of this ASP page uses the inner code.
< % @ Language = VBScript %>
< %
'Example of inline code
option explicit
'Declare variables
dim oconn
dim orS
dim connectionString
dim x
connectionString = dsn = Northwind;
set oconn = server.createObject (Adodb.connection)
oconn.open connectionString
setrs = Server.createObject (Adodb.oldSet)
'set variables
ondeconnection = Oconn
c c c c
ond.open
%>
<html>
<head>
<meta http-equiv = content-type content = text/html; charset = windows-1252>
<Title> New Page 1 < /Title>
< /head>
<body>
<h1> Products < /h1>
<Table cellspacing = 2 cellpadding = 5>
<trbgcolor =#ff6666>
<th> Product name < /th>
<th> Quantity Per Unitr < /th>
<th> Price < /th>
< /tr>
< %
do unil om.eof
if x = 1 then
x = 0
%>
<trbgcolor =#FFCCCC>
< % Else %>
<tr>
< %
x = 1
end if
%>
<td> < % = ORS (ProductName) %> < /td>
<td> < % = ORS (Quantityperunit) %> < /td>
<td> < % = ORS (UnitPrice) %> < /td>
< /tr>
< %
ondenext
loop
%>
< /table>
< /body>
< /html>
< %
'Destroy Objects
setrs = Nothing
set oconn = nothing
%>