ASP related articles or related products

Source: Internet
Author: User

In addition to the background, we usually set a "keyword", and the general input may be as follows:
Dolls, plush dolls, Japanese inflatable dolls
We will follow the steps below:
First look at an SQL statement: CopyCode The Code is as follows: Select top 3 Sid, sname from product where keywords like '% doll %' or keywords like '% plush doll %' or keywords like '% Japanese inflatable doll %'

Based on this statement, we can find related products or related products.Article(In fact, there are more complex and better implementations, but this is not mentioned here), the following is the key code:Copy codeThe Code is as follows: <% @ Language = "VBScript" codePage = "65001" %>
<% Response. charset = "gb2312" %>
<%
Dim A: A = "doll, plush doll, Japanese inflatable doll"

'Obj is the value and filed is the field name.
Function sqlkeyword (OBJ, field)
Dim temp: temp = Split (OBJ ,",")
For I = 0 to ubound (temp)
Sqlkeyword = sqlkeyword & field & "like '%" & temp (I) & "%' or"
Next
Sqlkeyword = left (sqlkeyword, Len (sqlkeyword)-3)
End Function

Dim MYSQL: MySQL = "select top 3 Sid, sname from product where" + sqlkeyword (a, "keywords ")
Response. Write (MySQL)
'Set objrs = objconn.exe cute (MySQL)
'Do while not objrs. EOF
'Response. Write (objrs ("sname "))
'Loop

'Objrs. Close
'Set objrs = nothing
'Objconn. Close
'Set objconn = nothing
%>

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.