asp中传递URL参数字符型转换为长整型

 

<%
id=trim(request("id"))

set rs=server.createobject("ADODB.recordset")
sql="select * from msg where ID=" & CLng(id)
rs.open sql,conn,1,3
if not rs.eof then
do while not (rs.eof or rs.bof)
rs.Delete       
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.Close
set conn = nothing
Response.Write("删除成功")
%>

先用trim 去点传递参数的空格

然后用clng函数把ID转换为长整型

负责数据查询不到记录

原文地址:https://www.cnblogs.com/yeye518/p/2231792.html