程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> 關於ASP編程 >> asp 刪除數據庫記錄

asp 刪除數據庫記錄

編輯:關於ASP編程

    asp教程 刪除數據庫教程記錄其實在asp中是很非常容易做的事情了,只要連接數據庫了,再利用sql delete函數來刪除就ok了,下面來看看實例吧。

    id = saferequest("id")
    sql="delete from table1 where whereid>"&id&""
    rs.open sql,conn,1,3
    response.write "<script>alert('刪除成功');location.href='del.asp';</script>"
    set rs=nothing
    set conn=nothing

    這是過濾非法字符函數

    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 "請不要在函數中加入非法字符!"
    response.end
    else
    saferequest=paravalue
    end if
    end function

    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved