page ASP
Auteur: Qing Apple Computer Studio Click: 351
Le premier arrêt de cet exemple est la page ASP. Cette page ASP est connectée à la base de données ADO et Northwind. Afin de maintenir une bonne habitude de codage, je
L'option explicite a été utilisée et a clairement déclaré toutes les variables. La première ébauche de cette page ASP utilise le code intérieur.
<% @ Language = vbscript%>
<%
'Exemple de code en ligne
option explicite
'Déclarer les variables
sombre oconn
sombre
dim connexion
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>
<adal>
<meta http-equiv = contenu contenu de type = text / html;
<Title> Nouvelle page 1 </TITME>
</ head>
<body>
<h1> Produits </H1>
<Table CellSpacing = 2 CellPadding = 5>
<trbgColor = # ff6666>
<th> Nom du produit </th>
<th> Quantité par unitr </th>
<th> Prix </th>
</tr>
<%
faire unil om.eof
Si x = 1 alors
x = 0
%>
<trbgColor = # ffcccc>
<% Else%>
<tr>
<%
x = 1
terminer si
%>
<td> <% = ors (productName)%> </td>
<td> <% = ORS (QuantityPerUnit)%> </td>
<td> <% = ors (unitprice)%> </td>
</tr>
<%
ondenext
boucle
%>
</ table>
</docy>
</html>
<%
'Détruiser les objets
setrs = rien
Set OCONN = Rien
%>