01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP & Oracle Tutorial</title>
05.
</head>
06.
<body>
07.
<%
08.
09.
Dim
Conn,strSQL,objRec
10.
Set
Conn = Server.Createobject(
"ADODB.Connection"
)
11.
Conn.Open
"Driver={Oracle in OraHome92};DBQ=TCDB;UID=myuser;PWD=mypassword;"
12.
strSQL =
"SELECT * FROM ( SELECT * FROM customer ORDER BY dbms_random.value ) WHERE rownum <= 3"
13.
Set
objRec = Server.CreateObject(
"ADODB.Recordset"
)
14.
objRec.Open strSQL, Conn, 1,3
15.
%>
16.
<table width=
"600"
border=
"1"
>
17.
<tr>
18.
<th width=
"91"
> <div align=
"center"
>CustomerID </div></th>
19.
<th width=
"98"
> <div align=
"center"
>Name </div></th>
20.
<th width=
"198"
> <div align=
"center"
>Email </div></th>
21.
<th width=
"97"
> <div align=
"center"
>CountryCode </div></th>
22.
<th width=
"59"
> <div align=
"center"
>Budget </div></th>
23.
<th width=
"71"
> <div align=
"center"
>Used </div></th>
24.
</tr>
25.
<%
26.
While
Not
objRec.EOF
27.
%>
28.
<tr>
29.
<td><div align=
"center"
><%=objRec.Fields(
"CustomerID"
).Value%></div></td>
30.
<td><%=objRec.Fields(
"Name"
).Value%></td>
31.
<td><%=objRec.Fields(
"Email"
).Value%></td>
32.
<td><div align=
"center"
><%=objRec.Fields(
"CountryCode"
).Value%></div></td>
33.
<td align=
"right"
><%=objRec.Fields(
"Budget"
).Value%></td>
34.
<td align=
"right"
><%=objRec.Fields(
"Used"
).Value%></td>
35.
</tr>
36.
<%
37.
objRec.MoveNext
38.
Wend
39.
%>
40.
</table>
41.
<%
42.
objRec.Close()
43.
Conn.Close()
44.
Set
objRec =
Nothing
45.
Set
Conn =
Nothing
46.
%>
47.
</body>
48.
</html>