<%
dim connect, rs, sql, tr, totrec
set connect = server.createobject("ADODB.Connection")
' ==========
' It have many method to open file. Some method does not work.
' connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("quizans.mdb"))
' connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\yourdir\db\quizans.mdb"))
' connect.open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\thaiall.com\allthai.quiz\quizans.mdb")
connect.open "provider=microsoft.jet.oledb.4.0; data source=" & Server.MapPath("quizans.mdb")
' ==========
sql = "select * from teacher where tid='" & request.form("tid") &"'"
sql = sql & " and pass ='" & request.form("pass") &"'"
set rs=server.createobject("ADODB.recordset")
rs.open sql,connect,1,3
totrec = rs.recordcount
if totrec = 0 then
response.write("Incorrect student id or password")
response.end
end if
if request.form("tbl") <> "math101ans" and request.form("tbl") <> "engl101ans" and request.form("tbl") <> "bcom101ans" and request.form("tbl") <> "test101ans" then
response.write("Incorrect table")
response.end
end if
response.write("<ol>Teacher id : " & request.form("tid"))
response.write("<br>Teacher name : " & rs("tname"))
sql = "delete * from "& request.form("tbl")
set rs = server.createobject("ADODB.recordset")
connect.execute(sql)
response.write("<br>delete : ok")
%>
จำนวน : 30 บรรทัด