Delete a single record
CopyCode The Code is as follows: Id = saferequest ("ID ")
SQL = "delete from Table1 where whereid>" & ID &""
Rs. Open SQL, Conn, 1, 3
Response. Write "<SCRIPT> alert ('deleted successfully'); location. href = 'del. asp '; </SCRIPT>"
Set rs = nothing
Set conn = nothing
This is a function for filtering invalid characters. Copy code The Code is 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 ), "Delete from")> 0 or instr (lcase (paravalue), "Count (")> 0 or instr (lcase (paravalue), "Drop table")> 0 or instr (lcase (paravalue), "Update")> 0 or instr (lcase (paravalue), "truncate")> 0 or instr (lcase (paravalue ), "ASC (")> 0 or instr (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 invalid characters to the function! "
Response. End
Else
Saferequest = paravalue
End if
End Function
Batch deletion method:
It is mainly implemented using the for loop.Copy codeThe Code is 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 rsw.conn.exe cute (SQL)
Shu = Shu + 1
Next