dim id
id=request.QueryString("id")
if IsNumeric(id)=False then
response.redirect "index.asp"
response.end
elseif not isinteger(id) then
response.redirect "index.asp"
response.end
else
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select * from table where id="&id,conn,1,3
if rs.recordcount = 0 then
rs.close
set rs=nothing
response.write "<script>alert(""该记录已不存在!"");location.href=""index.asp"";</script>"
response.end
end if
end if
==================
就以上代码,就是判断ID是不是为空或是不是整数!