ASP模糊查询表中指定字段是否包含指定内容函数asp

/ / 2025-04-06   阅读:2563
ASP模糊查询表中指定字段是否包含指定内容函数...

ASP检查指定表的指定字断中是否包含有某个值,支持模糊查找,这里用自定义函数来实现。函数作用:检测数据表中某个字段是否存在某个内容。


函数返回值:若不存在某内容返回false,存在返回true;


函数各个参数说明: 

table:需要查找的数据库表名

fieldname:字段名称

fieldcontent:要查找的字段内容

isblur:是否需要模糊匹配,取值0或1


ASP模糊查询表中指定字段是否包含指定内容函数代码

Function CheckExist(table,fieldname,fieldcontent,isblur)
CheckExist=false
If isblur=1 Then
   set rsCheckExist=conn.execute("select * from "&table&" where "&fieldname&" like '%"&fieldcontent&"%'")
else
   set rsCheckExist=conn.execute("select * from "&table&" where "&fieldname&"= '"&fieldcontent&"'")
End if
  if not (rsCheckExist.eof and rsCheckExist.bof) then CheckExist=true
rsCheckExist.close
set rsCheckExist=nothing

温馨提醒: 使用本函数前请先包含你的数据库连接文件。

我要评论

昵称:
验证码:

最新评论

共0条 共0页 10条/页 首页 上一页 下一页 尾页
意见反馈