Ultradev Example Tutorial: 3.7 Creating a Simple Query
Author:Eve Cole
Update Time:2009-05-30 18:34:41
Chapter 3: Applying Database to Create Dynamic Web Pages
Section 7: Create a simple query
In fact, the principle of query creation is the same as the data editing principle we learned above. They first pass a value from the first page to the second page, and then the second page takes out the corresponding value based on the passed value. record, and then perform corresponding processing, such as display, edit, and delete. The difference is the delivery method. In the previous section, we passed the value through address connection, and we know that general queries are filled in data through a form and then submitted.
Okay, let's take a look at the specific creation process.
First we need to create a page where users can enter query content. As shown in the figure, we insert a form field named Search with type Text and a submit button. Note that the name of this form field must be used after it. The name can be whatever you choose. Then we add an execution page for this form field. Position the cursor at the red line, and the Form properties panel will appear. In the Action column, fill in the address of the page you want to query and process. Here we use searchdo.asp to process it. We will create this page later. After all these settings are completed, save this page as search.asp, and the first page we use to pass the value is ready.
Next we create a second page, which is searchdo.asp. As usual, open the panel for creating a record set, as shown in the figure. Did you see any difference? By the way, Form Variable appears in Filter. Let me elaborate. Selecting username in Filter means that the scope we want to search is the field of username. In the condition column, we select contain, which means that the database will display the username field data as long as this field contains the content entered by the user. For example, username contains the following content a, aac, aaac. If the user searches with a, all three data will be displayed. If the user searches with ac, both aac and aaac will be displayed. Form Variable means that the record set accepts the value passed through the form. Search is the name of our form field. If your form field name is searchstring, it should be changed to searchstring accordingly. Click Ok and our record set is created.
After the record set is created, all we have to do is to display the records according to the record display method taught above.
Open a browser window and view the program's output.
This is the Sql code that Ultradev generated for us when we clicked the Advanced button. Did you see that Request.Form("search")? It seems familiar. *_'
Some basic functions of Dreamweaver Ultradev have been described here. After reading this, my friend, you should be able to do some basic data display, browsing, editing and deletion functions. Next, we will first talk about the plug-in usage function of Ultradev, and then we will consolidate what we have learned through a simple website background management program.
Why should we talk about the use of plug-ins first? Because many times we can use plug-ins to easily implement some functions, and some plug-ins will also be used in the subsequent background management program, so we will talk about the basic use of plug-ins first. Please pay attention.