ASPページ
著者:Qing Apple Computer Studioクリック:351
この例の最初の目的地はASPページです。このASPページは、ADOおよびNorthwindデータベースに接続されています。優れたコーディング習慣を維持するために、i
オプションの明示が使用され、すべての変数が明確に宣言されました。このASPページの最初のドラフトは、内部コードを使用します。
<% @言語= vbscript%>
<%
'インラインコードの例
オプションは明示的です
'変数を宣言します
DIM OCONN
薄暗い
Dim ConnectionString
dim x
connectionString = dsn = northwind;
oconn = server.createObject(adodb.Connection)を設定します
oconn.open connectionString
setrs = server.createObject(adodb.oldset)
'変数を設定します
ondeconnection = oconn
C C C C
ond.open
%>
<html>
<head>
<メタhttp-equiv = content-type content = text/html;
<Title>新しいページ1 < /title>
< /head>
<body>
<h1>製品< /h1>
<Table Cellspacing = 2 CellPadding = 5>
<trbgcolor =#ff6666>
<th>製品名< /th>
<th>単位あたりの数量< /th>
<th>価格< /th>
< /tr>
<%
OM.EOFをunilします
x = 1の場合
x = 0
%>
<trbgcolor =#ffcccc>
<%else%>
<tr>
<%
x = 1
ifを終了します
%>
<td> <%= ors(productname)%> < /td>
<td> <%= ors(quantingperunit)%> < /td>
<td> <%= ors(unitprice)%> < /td>
< /tr>
<%
ondenext
ループ
%>
< /table>
< /body>
< /html>
<%
'オブジェクトを破壊します
setrs =何もない
oconn =何も設定しません
%>