01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP & SQL Server Tutorial</title>
05.
</head>
06.
<body>
07.
<%
08.
On
Error
Resume
Next
09.
Dim
Conn1
10.
Set
Conn1 = Server.Createobject(
"ADODB.Connection"
)
11.
Conn1.Open
"Driver={SQL Server};Server=localhost;Database=personal;UID=sa;PWD=;"
12.
If
Err.Number <> 0
Then
13.
Response.write(
"(SQL Server Driver) Database cannot connect Error = "
& Err.Description&
"<br>"
)
14.
Else
15.
Response.write(
"(SQL Server Driver) Database connected.<br>"
)
16.
End
If
17.
18.
Conn1.Close()
19.
Set
Conn1 =
Nothing
20.
21.
Dim
Conn2
22.
Set
Conn2 = Server.Createobject(
"ADODB.Connection"
)
23.
Conn2.Open
"personal"
,
"sa"
,
""
24.
If
Err.Number <> 0
Then
25.
Response.write(
"(ODBC) Database cannot connect Error = "
& Err.Description&
"<br>"
)
26.
Else
27.
Response.write(
"(ODBC) Database connected.<br>"
)
28.
End
If
29.
30.
Conn2.Close()
31.
Set
Conn2 =
Nothing
32.
33.
34.
%>
35.
</body>
36.
</html>