How to implement a search function in a program, the program implements the search function

Source: Internet
Author: User

How to implement a search function in a program, the program implements the search function

For example, in a blog, a search function is "find and view". You try to enter some information and it can quickly search for relevant information. However, it seems that only two keywords can be entered, separated by spaces.

If our website also needs a search function, only one text box and one button are provided.

To achieve this search function, you may find information in multiple tables or one or two fields in a table.

The following describes how to implement Insus. NET. You can refer to, correct, and optimize it.


In a program, you can design an interface as follows:


Next, you need to make a keyword for user input. Users may use spaces to separate, comma, and share. You need to handle it. The following Insus. NET uses space as an example:

In the database, we should define a table type to facilitate the input of these keywords to the database:

 
Button Click event:

 


In the preceding Click event, there is an attribute and a method:


The actual processing is on the Stored Procedure usp_SixS_Search. The query information is distributed in multiple tables. Therefore, we need to refer to this article to implement multi-Table Association for your SELECT query function http://www.cnblogs.com/insus/p/4101900.html. how can we associate multiple tables.

 
The following is the stored procedure:

 

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.