01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP TextStream
Object
</title>
05.
</head>
06.
<body>
07.
<%
08.
Dim
Conn,strSQL,objExec
09.
10.
11.
Set
Conn = Server.Createobject(
"ADODB.Connection"
)
12.
Conn.Open
"DRIVER=Microsoft Access Driver (*.mdb);DBQ="
& Server.MapPath(
"mydatabase.mdb"
),
""
,
""
13.
14.
15.
Dim
objFSO, objStream
16.
Set
objFSO = Server.CreateObject(
"Scripting.FileSystemObject"
)
17.
Set
objStream = objFSO.OpenTextFile(Server.MapPath(
"MyFiles/thaicreate.txt"
))
18.
Do
Until
objStream.AtEndOfStream
19.
arrRows = Split(objStream.ReadLine,
" "
)
20.
strSQL =
""
21.
strSQL = strSQL &
"INSERT INTO customer2 "
22.
strSQL = strSQL &
"(CustomerID,Name,Email,CountryCode,Budget,Used) "
23.
strSQL = strSQL &
"VALUES "
24.
strSQL = strSQL &
"('"
&arrRows(0)&
"','"
&arrRows(1)&
"','"
&arrRows(2)&
"' "
25.
strSQL = strSQL &
",'"
&arrRows(3)&
"','"
&arrRows(4)&
"','"
&arrRows(5)&
"') "
26.
Set
objExec = Conn.Execute(strSQL)
27.
Set
objExec =
Nothing
28.
Loop
29.
objStream.Close
30.
31.
Set
objStream =
Nothing
32.
Set
objFSO =
Nothing
33.
%>
34.
</body>
35.
</html>