01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com Tutorial</title>
05.
</head>
06.
<body>
07.
<%
08.
Dim
Conn,strSQL,objRec,intRows
09.
Set
Conn = Server.Createobject(
"ADODB.Connection"
)
10.
Conn.Open
"DRIVER=Microsoft Access Driver (*.mdb);DBQ="
& Server.MapPath(
"db/mydatabase.mdb"
),
""
,
""
11.
12.
strSQL =
"SELECT * FROM gallery "
13.
Set
objRec = Server.CreateObject(
"ADODB.Recordset"
)
14.
objRec.Open strSQL, Conn, 1,3
15.
16.
Response.Write(
"<table border='0' cellspacing='1' cellpadding='1'><tr>"
)
17.
18.
intRows = 0
19.
20.
While
Not
objRec.EOF
21.
intRows = intRows + 1
22.
Response.Write(
"<td>"
)
23.
%>
24.
<center>
25.
<img src=
"thaicreate/<%=objRec.Fields("
Picture
").Value%>"
><br>
26.
<%=objRec.Fields(
"GalleryName"
).Value%>
27.
<br>
28.
</center>
29.
<%
30.
Response.Write(
"</td>"
)
31.
If
intRows
Mod
2 = 0
Then
32.
Response.Write(
"</tr>"
)
33.
End
If
34.
35.
objRec.MoveNext
36.
Wend
37.
Response.Write(
"</tr></table>"
)
38.
39.
objRec.Close()
40.
Conn.Close()
41.
Set
objRec =
Nothing
42.
Set
Conn =
Nothing
43.
%>
44.
</body>
45.
</html>