内容显示页
 
类别:ASP+VBS | 浏览(156) | 2006-12-1 15:40:00 | 关闭广告
<%
Function AutoKey(strKey)

Const lngSubKey=2
lngLenKey=Len(strKey)

Select Case lngLenKey
Case 0   '若为空串,转到出错页
Response.Redirect "Error.htm"
Case 1   '若长度为1,则不设任何值
strNew1=""
strNew2=""
Case Else  '若长度大于1,则从字符串首字符开始,循环取长度为2的子字符串作为查询条件

For i=1 To lngLenKey-(lngSubKey-1)

strSubKey=Mid(strKey,i,lngSubKey)

strNew1=strNew1 & " Or U_Name like '%" & strSubKey & "%'"
strNew2=strNew2 & " Or U_Info like '%" & strSubKey & "%'"
Next
End Select

'得到完整的SQL语句
AutoKey="Select * from T_Sample where U_Name like '%" & strKey & "%' Or U_Info like '%" & strKey & "%'" & strNew1 & strNew2
End Function
%>

引用本页地址:http://www.yongfa365.com/item/4f3dece718da8a89.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片看不清? 换张图试试
 
   
 
 
文章分类
 
   

Power by :柳永法(yongfa365)'Blog | Model by :hibaidu | CSS by:众网友 | 京ICP备07011491号  QQ:64049027  E-mail:64049027qq.com

本空间赞助商:北京中科兴联信息技术有限公司