ASP实现智能搜索实现代码_应用技巧

<%
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
%>

时间: 2024-08-01 21:36:50

ASP实现智能搜索实现代码_应用技巧的相关文章

asp.net和ajax实现智能搜索功能代码_实用技巧

第一步,先做好搜索页面 复制代码 代码如下: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://

ASP智能搜索的实现_应用技巧

用ASP实现搜索引擎的功能是一件很方便的事,可是,如何实现类似3721的智能搜 索呢?比如,当在搜索条件框内输入"中国人民"时,自动从中提取"中国". "人民"等关键字并在数据库内进行搜索.看完本文后,你就可以发现,这个功 能实现起来竟然是如此的简单.OK,Follow Me!     第一步,我们要建立一个名为db_sample.mdb的数据库(本文以Access2000数 据库为例),并在其中建立表T_Sample.表T_Sample包括如下

ASP实现智能搜索实现代码

<% 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,则从字符串首字符开始,循环取长

最详细的ASP.NET微信JS-SDK支付代码_实用技巧

本文实例为大家分享了微信JS SDK支付的具体代码,供大家参考,具体内容如下 模型层实体类: public class JsEntities { /// <summary> /// 公众号id /// </summary> public string appId { get; set; } /// <summary> /// 时间戳 /// </summary> public string timeStamp { get; set; } /// <su

fso asp生成静态html的代码_应用技巧

FSO生成静态HTML文件的时候替换模板标签一直是一个很麻烦的问题,至少我是这么认为的,还要别外做一个模板,麻烦!,我今天看见有一个方法可以解决这个问题         如一个正常的index.asp页面,并且用ASP代码调出数据库中的内容,另建一个makehtml.asp的页面,加入一个textarea域,假设为name="body",将index.asp在textarea里调出来,如:  <textarea name="body"><!--#i

ASP Google的translate API代码_应用技巧

直接看代码: 复制代码 代码如下: Class GoogleTranslator sub Class_Initialize() RURI="http://translate.google.com/translate_t?langpair={0}&text={1}" End Sub Private Opt_ ' Property Get Opt Opt=Opt_ End Property Property Let Opt(Opt_s) Opt_=Opt_s End Propert

asp.net url分页类代码_实用技巧

复制代码 代码如下: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; usi

jQuery AJax调用asp.net webservers的实现代码_实用技巧

aspx页面代码 复制代码 代码如下: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <script src="JQUERY.JS" type="text/javascript"></script> <style type=&quo

asp.net 购物车实现详细代码_实用技巧

<%@ Page language="c#" Codebehind="shoppingcart.aspx.cs" AutoEventWireup="false" Inherits="myshop.shoppingcart" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML> <