01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP & MySQL Tutorial</title>
05.
</head>
06.
<body>
07.
<%
08.
09.
Dim
Conn,strSQL,objRec
10.
Set
Conn = Server.Createobject(
"ADODB.Connection"
)
11.
Conn.Open
"DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root; "
& _
12.
"pwd=;database=Blog_asp_db;option=16384;"
13.
strSQL =
"SELECT * FROM asp-admin "
14.
Set
objRec = Server.CreateObject(
"ADODB.Recordset"
)
15.
objRec.Open strSQL, Conn, 1,3
16.
%>
17.
<table width=
"600"
border=
"1"
>
18.
<tr>
19.
<th width=
"91"
> <div align=
"center"
>CustomerID </div></th>
20.
<th width=
"98"
> <div align=
"center"
>Name </div></th>
21.
<th width=
"198"
> <div align=
"center"
>pass </div></th>
22.
<th width=
"97"
> <div align=
"center"
>Isadmin </div></th>
23.
24.
</tr>
25.
<%
26.
While
Not
objRec.EOF
27.
%>
28.
<tr>
29.
<td><div align=
"center"
><%=objRec.Fields(
"Aid"
).Value%></div></td>
30.
<td><%=objRec.Fields(
"AUserName"
).Value%></td>
31.
<td><%=objRec.Fields(
"APassword"
).Value%></td>
32.
<td><div align=
"center"
><%=objRec.Fields(
"AIsAdmin"
).Value%></div></td>
33.
</tr>
34.
<%
35.
objRec.MoveNext
36.
Wend
37.
%>
38.
</table>
39.
<%
40.
objRec.Close()
41.
Conn.Close()
42.
Set
objRec =
Nothing
43.
Set
Conn =
Nothing
44.
%>
45.
</body>
46.
</html>