isinteger类型不匹配

jeyky 2009-12-17 09:01:12
if not isinteger(id) then
提示isinteger未定义变量错误
如果定义了,就变成类型不匹配
...全文
159 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxq323 2009-12-18
  • 打赏
  • 举报
回复
VBScript里没有isinteger()这个关键字判断是否为数字用IsNumeric

要想定义就定义成函数

function isinteger(id)
end function
yan11cn 2009-12-18
  • 打赏
  • 举报
回复
我也记着VBScript里没有isinteger()
anbs01 2009-12-18
  • 打赏
  • 举报
回复
isinteger()是在javascript里
asp当中应该用IsNumeric()判断是否为数字。
lingyun410 2009-12-18
  • 打赏
  • 举报
回复
注意一下接收的ID的数据类型!~~
jeyky 2009-12-17
  • 打赏
  • 举报
回复
还是一样
要不换成这样说吧!
你们在做有传递ID页面时是怎么做的?
就比较,现在表中就一个记录ID=1
网址localhost/1.asp?id=1正常访问
如果我改了id=2或id=a或id=或直接输入1.asp后边不带.结果肯定是错的,你们怎么做呢?
yan11cn 2009-12-17
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 jeyky 的回复:]
引用 5 楼 yan11cn 的回复:
上面打错了
rs.open "select * from table where id="&id,conn,1,3
改成
rs.open "select * from table whereid='"& id & "'",conn,1,3


出错的在上一行,跑这来干嘛了...
[/Quote]

你的表里面id这个字段要是字符串 就得这样 你试试
jeyky 2009-12-17
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 net_lover 的回复:]
asp里面没有isinteger

if IsNumeric(id)=False then
  response.redirect "index.asp"
  response.end
else
  id=CLng(id)
[/Quote]
我另一个页面使用着就正常的!
jeyky 2009-12-17
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 yan11cn 的回复:]
上面打错了
rs.open "select * from table where id="&id,conn,1,3
改成
rs.open "select * from table whereid='"& id & "'",conn,1,3

[/Quote]
出错的在上一行,跑这来干嘛了...
yan11cn 2009-12-17
  • 打赏
  • 举报
回复
上面打错了
rs.open "select * from table where id="&id,conn,1,3
改成
rs.open "select * from table where id='"& id & "'",conn,1,3
yan11cn 2009-12-17
  • 打赏
  • 举报
回复
rs.open "select * from table where id="&id,conn,1,3
改成
rs.open "select * from table where id='"& id & """,conn,1,3
孟子E章 2009-12-17
  • 打赏
  • 举报
回复
asp里面没有isinteger

if IsNumeric(id)=False then
response.redirect "index.asp"
response.end
else
id=CLng(id)
jeyky 2009-12-17
  • 打赏
  • 举报
回复
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是不是为空或是不是整数!
yan11cn 2009-12-17
  • 打赏
  • 举报
回复
isinteger 是自己写的函数么 把相关代码贴一下吧 问题才能看清楚点

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧