这个函数就能解决! Function SafeRequest(ParaName,ParaType) '传入参数 'ParaName:参数名称-字符型 'ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符) if ParaName<>"" then Dim ParaValue
ParaValue=TRIM(ParaName) If ParaType=1 then If not isNumeric(ParaValue) then Response.write "参数 <font color=#ff0000>" & ParaName & "</font> 必须为数字型!" Response.end End if Else ParaValue=replace(ParaValue,"'","''") End if end if SafeRequest=ParaValue End function
Function SafeRequest(ParaName,ParaType)
'传入参数
'ParaName:参数名称-字符型
'ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符)
if ParaName<>"" then
Dim ParaValue
ParaValue=TRIM(ParaName) If ParaType=1 then
If not isNumeric(ParaValue) then
Response.write "参数 <font color=#ff0000>" & ParaName & "</font> 必须为数字型!"
Response.end
End if
Else
ParaValue=replace(ParaValue,"'","''")
End if
end if
SafeRequest=ParaValue
End function