ASP related articles or related products _ application skills

Source: Internet
Author: User
In the background to add in general we have set a "keyword", and the general input may be as follows:
Doll, plush doll, Japanese inflatable doll
We will do this according to this, the following specific implementation:
First look at an SQL statement:
Copy Code code as follows:

Select Top 3 sid,sname from product where keywords like '% doll% ' or keywords like '% plush doll% ' or ' keywords like '% Japanese inflatable doll% '

So we can search for products or related articles based on this statement (in fact, there are more complex and better implementations, but this is not mentioned here), here is the key code:
Copy Code code as follows:

<% @LANGUAGE = "VBSCRIPT" codepage= "65001"
%> response.charset= "gb2312"%>
<%
Dim a:a = "doll, plush doll, Japanese inflatable doll"

' obj as value, filed as field name
Function s Qlkeyword (Obj,field)
Dim temp:temp = Split (obj, ",")
for i = 0 To UBound (temp)
Sqlkeyword = Sqlkeyword &A mp field& "like"% &temp (i) & "% ' or"
Next
Sqlkeyword = Left (Sqlkeyword,len (Sqlkeyword)-3)
End F Unction

Dim mysql:mysql = "SELECT Top 3 sid,sname from product where" + Sqlkeyword (A, "keywords")
Respon Se. Write (MySQL)
' Set objRS = objConn.Execute (mysql)
' do as not objrs.eof
' Response.Write (objRS ("sname"))
' Loop

' objrs.close
' Set objRS = Nothing
' objconn.close
' Set objconn = Nothing
% >
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.