|
您的位置: 首頁 > 網站資訊 > ASP防SQL注入的方法淺談 |
ASP防SQL注入的方法淺談發布日期:2017/8/27
一下為ASP防SQL注入的代碼: Dimconn,cmd,pra setconn=server.createobject("adodb.connection") conn.Open"…………"'這里省略數據庫連接字 setcmd=server.createobject("adodb.Command") setpra=server.createobject("adodb.Parameter") cmd.ActiveConnection=conn cmd.CommandText="updatenewssettitle=?whereid=?" cmd.CommandType=adCmdText Setpra=cmd.CreateParameter("title",adVarWChar,adParamInput,50,"1'2'3") cmd.Parameters.Appendpra Setpra=cmd.CreateParameter("id",adInteger,adParamInput,,10) cmd.Parameters.Appendpra cmd.Execute news表的id字段是Integer型的,title字段是nvarchar(50)型的,執行的效果是把news表中id字段為10的記錄的title字段的內容改成“1'2'3”
|
其他相關文章 |
|
|
|
|||||||||
Copyright 2012-2025 上海蒙狼網絡科技有限公司 www.zcrhy.com.cn All Rights Reserved |