<%
sub insertdata
randomize
c = chr(int(26*rnd)+65) + chr(int(26*rnd)+65) + chr(int(26*rnd)+65)
r = int(10000*rnd)
sql="insert into tempfile(tmpch,tmpnum,tmpdate)values('"&c&"',"&r&",'"&Now&"')"
connect.execute(sql)
response.write(sql & " : ok<br>")
end sub
' =====
on error resume next
dim connect, sql, objerr, c, r
set connect = server.createobject("ADODB.Connection")
connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &_
Server.MapPath("\perlphpasp\db\tempdb.mdb"))
sql = "create table tempfile (tmpch char(20), tmpnum integer, tmpdate char(20))"
connect.execute(sql)
if connect.errors.count > 0 then
for each objerr in connect.errors
response.write(objerr.description & "<br>")
next
else
response.write(sql & " : ok<br>")
for i = 1 to 5 : insertdata : next
end if
connect.close
set connect = nothing
%>
จำนวน : 28 บรรทัด