01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP & Microsoft Access Tutorial</title>
05.
</head>
06.
<body>
07.
<%
08.
Dim
Conn,strSQL,objExec
09.
Set
Conn = Server.Createobject(
"ADODB.Connection"
)
10.
Conn.Open
"DRIVER=Microsoft Access Driver (*.mdb);DBQ="
& Server.MapPath(
"mydatabase.mdb"
),
""
,
""
11.
strSQL =
""
12.
strSQL = strSQL &
"INSERT INTO customer "
13.
strSQL = strSQL &
"(CustomerID,Name,Email,CountryCode,Budget,Used) "
14.
strSQL = strSQL &
"VALUES "
15.
strSQL = strSQL &
"('"
&Request.Form(
"txtCustomerID"
)&
"','"
&Request.Form(
"txtName"
)&
"', '"
&Request.Form(
"txtEmail"
)&
"' "
16.
strSQL = strSQL &
",'"
&Request.Form(
"txtCountryCode"
)&
"','"
&Request.Form(
"txtBudget"
)&
"', '"
&Request.Form(
"txtUsed"
)&
"') "
17.
Set
objExec = Conn.Execute(strSQL)
18.
If
Err.Number = 0
Then
19.
Response.write(
"Save Done."
)
20.
Else
21.
Response.write(
"Error Save ["
&strSQL&
"] ("
&Err.Description&
")"
)
22.
End
If
23.
Conn.Close()
24.
Set
objExec =
Nothing
25.
Set
Conn =
Nothing
26.
%>
27.
</body>
28.
</html>