Delete a single record
Copy Code code as follows:
id = saferequest ("id")
Sql= "Delete from table1 where whereid>" &id& "
Rs.Open sql,conn,1,3
Response.Write "<script>alert (' delete success '); location.href= ' del.asp ';</script>"
Set rs=nothing
Set conn=nothing
This is the filter illegal character function
Copy Code code as follows:
function Saferequest (paraname)
Dim paravalue
Paravalue=request (Paraname)
If IsNumeric (paravalue) = True Then
Saferequest=paravalue
Exit function
ElseIf InStr (LCase (Paravalue), "select") > 0 or InStr (LCase (Paravalue), "Insert") > 0 or InStr (LCase (Paravalue), "de Lete from ") > 0 or InStr (LCase (Paravalue)," Count (") > 0 or InStr (LCase (Paravalue)," drop table ") > 0 or InStr (Lcas E (Paravalue), "Update") > 0 or InStr (LCase (Paravalue), "truncate") > 0 or InStr (LCase (Paravalue), "ASC (") > 0 or I Nstr (LCase (Paravalue), "Mid (") > 0 or InStr (LCase (Paravalue), "char (") > 0 or InStr (LCase (Paravalue), "xp_cmdshell" ) > 0 or InStr (LCase (Paravalue), "exec master") > 0 or InStr (LCase (Paravalue), "net localgroup Administrators") > 0 or InStr (LCase (Paravalue), "and") > 0 or InStr (LCase (Paravalue), "NET user") > 0 or InStr (LCase (Paravalue), "or") > 0 or InStr (LCase (Paravalue), "" "" ") >0 or InStr (LCase (Paravalue)," ' ") >0 Then
Response.Write "Please do not add illegal characters to the function!" "
Response.End
Else
Saferequest=paravalue
End If
End Function
Bulk Deletion method:
This is mainly achieved by using a for loop.
Copy Code code as follows:
Id=request.form ("checkbox")
Id=split (ID, ",")
Shu=0
For i=0 to UBound (ID)
Sql= "SELECT * from Jiang_fname where id=" &id (i)
Set Rs=conn.execute (SQL)
Shu=shu+1
Next