programming-examples/asp/Miscellaneous/Iteration through asp objects.asp
2019-11-18 14:25:58 +01:00

28 lines
1.0 KiB
Plaintext

<%
tName=request.form("tableName")'the table on which to act
if request.form("flag")="Delete" then
if request.form("tableName").count >1 then 'delete from more then one table
for each tabl in request.form("tableName")'for each table
if request.form("cbdel").count >= 1 then'if records were marked
for i = 1 to request.form("cbdel").count
conn.execute"DELETE FROM "&tabl&" WHERE "&request.form("cbdel")(i)&" ;"'cbdel holds the 'where' clause of the sql
'response.write"DELETE FROM "&tabl&" WHERE "&request.form("cbdel")(i)&" ;"
next
end if
next
else 'delete from one table
if request.form("cbdel").count >= 1 then'if records were marked
for i = 1 to request.form("cbdel").count
conn.execute"DELETE FROM "&tName&" WHERE "&request.form("cbdel")(i)&" ;"
'response.write"DELETE FROM "&tName&" WHERE "&request.form("cbdel")(i)&" ;"
next
end if
end if
end if 'of delete action
%>