判断ID是不是数值型的.
Dim ID
ID = Format_Number(Request.QueryString("ID"))
If Not IsNumeric(ID) Then
response.Redirect("articles.asp")
Response.End
End If
Function Format_Number(str)
Dim i,l
Dim onlyNum : onlyNum = ""
If IsNumeric( str & "") Then
Format_Number = Clng(str)
Else
l = Len(str)
For i=1 to l
If IsNumeric(Mid(str, i, 1)) Then
onlyNum = onlyNum & Mid(str, i, 1)
End If
Next
Format_Number= onlyNum
End If
End Function
把ID附值的另一种方式
Dim id
id = request(“ID”)
If id <> "" then id = CLng(id)
判断下ID的正确与否。
- 评论:(0)
发表评论 点击这里获取该日志的TrackBack引用地址