Dreamweaver
11th Chapter doking ' s blog site search implementation
Often see many sites have a site search function, this is how to achieve it? If it is an ASP, the Dreamweaver will soon be realized. Now it's asp.net, I have to make a little hand.
11.1 Select Advanced Search Tips
After learning from the above chapters, the number of select points will be understood. Select Advanced search techniques, in fact, there is no mystery, mainly with the use of pattern matching operators. Therefore, this paper mainly explains the application of pattern matching operators.
Pattern-matching operators like and not are often used for fuzzy lookup, which determines whether a column value matches the specified string format. Like is used to find records that match a certain condition, not like to find records that do not match a specified condition. Can be used for type queries such as strings, text, dates, and so on.
1. Percent percent: can match characters of any type and length.
For example: SELECT Learning notes from learning notes WHERE title like "Network%"
This query is to query the Learning Notes table in the title of "Network" to start all the learning notes, such as: Network database ASP point through, Network and mobile communication development research.
For example: SELECT Learning notes from learning notes WHERE title like "%asp.net%"
This query is to query all headings that contain "asp.net" learning notes.
2. Underline _: Matches a single character, commonly used to limit the length of the character of an expression.
For example: SELECT Learning Notes from learning Notes table WHERE title like "V_ Development Select"
This query is mainly a query similar to the "VB Development Select", "VC development Select" such as the title of the study notes.
3. Bracket []: Specifies a character, string, or range, requiring that the matched object be any of them.
Implementation of search function in 11.2 station
After introducing the Select Advanced Search technique, we will introduce the realization of the search function in the station. Here only the percent semicolon% pattern matching operator is used.
(1) Open the template dkblog.dwt.aspx, insert the form, set id= "Gofrm", Action for "... /dkgo.aspx ", the method is" POST "; Insert text box, set id=" Dkgotxt ", Insert button" search ", the result is as shown in Figure 11-1.
(2) Save the template dkblog.dwt.aspx update all pages.
(3) Create a new blank asp.net VB dynamic page and save it as dkgo.aspx. Add DataSet Ztre, which is set as shown in Figure 11-2.
Figure 11-1 Adding the form control
Figure 11-2 Adding data set Ztre
(4) Click the "Advanced" button to put the SQL command:
SELECT * from ZT zitime DESC
To
SELECT * from ZT WHERE ztname like '% ' +request.form ("dkgotxt") + "%" ORDER by Zitime DESC
The result is shown in Figure 11-3.
Figure 11-3 Modifying the dataset Ztre
(5) on the dkgo.aspx page for the design, binding on dynamic text to the page, design important areas, the results are shown in Figure 11-4.
Figure 11-3 Page Setup for dkgo.aspx
For setup details, you can refer to the index.aspx settings.