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: