ASP Delete database records

Source: Internet
Author: User

ASP Tutorial Delete database tutorial Records in fact, in the ASP is very easy to do things, as long as the connection to the database, and then use the SQL Delete function to delete the OK, let's take a look at the example.

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

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), "trunc Ate ") > 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 (l Case (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 (Paravalu e), "'" >0 then
RESPONSE.WRIte "Please do not add illegal characters to the function!" '
Response.End
Else
Saferequest=paravalue
End If
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.