dreamweaver| Query System recently the company in order to make full use of book resources to facilitate staff inquiries, decided to establish a book in the company's internal online inquiry system. Considering the company's books are not many, only 1000 copies, and the majority of professional book characteristics, I decided to make two query criteria: One is based on the category of books to query, users simply select the appropriate category can show the category of all books, this is mainly in the face of the company books unfamiliar people; the second is based on the name of the book to query, The user simply enters the name of the book and can quickly search for all the books that match the criteria.
The plan is set, and then there is the question of what software to do and how to do it. Here, I chose the form of the Web page, so that colleagues just open the browser, enter the appropriate address can be queried.
First, create a database:
First, create a new folder under my document named "Institute". Of course, you can also create new names elsewhere.
Open acess, create a new database DB1, set up two tables Leibie and Tushu, and the contact field between tables is "category name."
Table Leibie structure is two fields:
(1) Category number, text type, field length is 6 bits, required field, not allowed to enter blank string;
(2) Category name, text type, field length is 20 bits, required field, not allowed to enter blank string.
Table Tushu structure is nine fields:
(1) Number, text type, field length is 6 bits;
(2) Title, text type, field length is 60 bits, required field, not allowed to enter a blank string.
(3) Author, text type, field length is 50 bits;
(4) Publisher, text type, field length is 60 bits;
(5) Edition, text type, field length is 15 bits;
(6) Unit price, currency type, allow the number of decimal places 2 digits, the default value is 0 yuan;
(7) Category name, text type, field length is 20 bits, required field, not allowed to enter blank string.
(8) Whether the loan, text type, field length is 4 bits, required fields, not allowed to enter a blank string, the default value is No.
(9) Remark, Memo type.
Enter the data according to the table structure.
Next, set up the site and connect the database:
(1) Set up the site. Open DW, select the Site menu newsite, pop-up settings site panel, station named Input Institute, directory is the directory we have just established, as shown in the 1,testingserver option Servermodel Select ASP VBScript, Access selects Local/network.
(2) Create a new page because the query is a dynamic page, so select Dynamicpage and Aspvbscript in the pop-up panel, as shown in Figure 2. Press the Create button to return to the page.
(3) connecting to the database. Expand the application panel on the right, select the Databases tab, press the + button, and select DataSourceName (DSN), as shown in Figure 3.
(4) On the pop-up data SourceName (DSN) panel (Figure 4) Select Define ... button into the ODBC Data Source Manager, select the System DSN tab, click the Add button, select Driverdomicrosoft Access (*.mdb) data driver, click the Finish button.
(5) Select the database path (that is, the directory we just created) on the subsequent panel, select DB1, and enter the data source name DB1, as shown in Figure 5.
(6) Click the OK button to return to the ODBC Data Source Administrator panel. Then click the OK button to return to the data SourceName (DSN) panel. Click on the Test button, if pop-up as shown in Figure 6 of the success of the panel, it shows all OK, the database has been connected, the right application Panel databases label will be corresponding to the emergence of our new data source DB1.
now all ready to work, you can build dynamic query page.
First, the establishment of the homepage. The main page is very simple, is to establish two query links, "by book category query" link to chaxun.asp, "by Book Name query" link to chaxun1.asp, these two pages is the following we want to establish the query page. Home page Because do not need dynamic programming, can be stored as HTM format, the file is saved to the Research institute directory, named Index, specifically, as shown in Figure 7.
Second, the establishment by the book category inquires the webpage.
1, a new Dynamic Web page, named Chaxun.asp.
2, set up a recordset. Select the Bindings tab in the application panel on the right and press the plus button to select the recordset (Query), as shown in Figure 8, to eject the recordset dialog box, where the settings like Figure 9,name take the default value Recordset1, Connection Select the connection DB1 we just established, because the book category is displayed, so table Leibie is selected.
3, after setting, click the Test button, you can see the contents of the Leibie table are all displayed. Click OK to return to the page, at which point we can see that the binding tag below shows the query we just created called Recordset1.
4, input Web page static display content, such as Figure 10, where "back" link to the home page index.htm.
5, click on the binding label next to the + Recordset1, expand the field, with the mouse hold down the category Name field, drag directly onto the page cell, release the mouse, so that the cell contains a dynamic text.
Just now that the cell can only display a row (you can first look in the browser is not such a display effect), then how to all the field content to display it?
6, select the table, and then select the right side of the application panel in the serverbehaviors tag, press the plus button, select Repeatregion (circular region), so you can control how many records a page display. Here, because the category of books is not much, so select Allrecords (Show All Records) in the dialog box, as shown in the page, specifically Figure 12.
7, run PWS, set a good path, with the browser to open this page, to see whether the screen will be the name of the category in the database are displayed, but now can not click in. OK, let's do the corresponding page to display the book.
Third, the production by Category query Display page
1, a new Dynamic Web page, named Xianshi.asp.
2, set up a recordset. Select the Bindings tab in the Application panel, press the plus button, select the recordset (Query), eject the recordset dialog box, the settings in Figure 13, name Recordset2, database table Select Tushu, Because the page display of the book information is based on the previous query conditions to display, so you need to set a limit to select the conditions of the book, then this condition is through what to achieve transmission and acceptance of it? This requires the use of the Urlparameter (url parameter), which can be used to pass query criteria from the Query Web page, and then accept this parameter in the Display Web page to display the records that match. The specific use of the following methods:
(1) Let's go back to the query page chaxun.asp. With the mouse to select the field in the table, and then select the application panel on the Serverbehaviors label, press the plus button, select goto Detail page (to the Details page), pop-up Go to Detailpage dialog box, specific settings such as Figure 14. Detailpage is our display page. The Xianshi.asp,passurlparameter text box is the name of the parameter that you want to pass through the URL to the detail page, and for the sake of understanding, we enter the category name. The name can be the same as the name of the parameter that is set in the following display page. Where the recordset means to pass out from which recordset, we choose Recorset1,column meaning as the source of the URL parameter value, to be consistent with the query criteria on the query page, so select category name. Passexistingparameters these two options are related to the table, and the form is not used on this query page, so you can not select it. By clicking the OK button, you can see that the field in the table has become a hypertext connection that contains dynamic content.
(2) OK, Urlparameter has been set, now return to the Display page xianshi.asp to accept this parameter. Select the recordset (query), Pop the recordset dialog box, and set the filter to Figure 13, which means that the query condition for the field "category name" in table Tushu is equal to the Urlparameter parameter "category name" passed over. This way, the query page and the display page are linked.
(3) test by clicking the Test button. You can enter a category name, DW will display the corresponding book records.
(4) Click OK button to return to the page, set up the recordset.
3, the input of static content in the Web page, such as Figure 15, where the "back" link to the query page chaxun.asp, because there are more categories of books, so the display is set to page display.
4, using the method described above, drag the field of the recordset to the corresponding position on the page, as shown in Figure 16.
5, select the second line in the table, click on the application panel in the serverbehaviors tag, press the plus button, select Repeatregion, Pop-up repeatregion dialog box, because to page display, so choose each show a few, Here I entered is 10, meaning for each page to display 10 records, you can freely enter according to the situation, as shown in Figure 17. Click the OK button to return to the page. 5
6, because it is pagination display, need to page, then in DW how to achieve it? Very simple, we first select "Home", and then click on the application panel in the serverbehaviors tag, press the plus button, you can see a recordsetpaging option, slide the mouse to this option, display a drop-down menu, The meaning of these menus I think you should understand it, as shown in Figure 18. Select the first "Movetofirstrecord", pop-up dialog box, such as Figure 19, click OK button back to the page, so that "home" dynamic link on the good, the other "", "", "last" and so on, and so do their corresponding dynamic link.
7, then how do users know that the record has been to the last one, and should not be further down? Here, I was resolved, if the record has been to the last, then "", "last" on the page automatically hidden, similarly, the record has been to the first, then "Home", "" "Automatically hidden. The following are the implementation methods:
(1) We first select "Home", then click on the application panel in the Serverbehaviors tab, press the plus button, slide the mouse to the Showregion option, showing the Drop-down menu, as shown in Figure 20.
(2) Select "Show Region if Notfirstrecord", meaning that if the first record is not displayed, the other way is if the first record is not displayed, hidden.
(3) In the pop-up dialog box directly click on the OK button back to the page, so "home" automatic hiding function is done.
(4) The same, do a few other automatic hiding function. "" and "Home", select "Show Region if Notfirstrecord", "" and "Last", select "Show Region if not". 6
At this point, by Category query Display page finally finished production, we look at the specific effect. Run PWS, with IE open chaxun.asp, click on a category name, such as "New drug", IE will automatically show the category of books, click "", "" and so on links to see if IE will automatically turn the page, the specific effect of Figure 21, 22.
Iv. making a Web page based on the name of the book
1, a new Dynamic Web page, named Chaxun1.asp.
2, the input of the Web page static display of content, such as Figure 23, where "return" Link to homepage index.htm, red dotted line indicates that this is a form, the form's property settings are shown in Figure 24, which means post (pass) a form variable name to the Xianshi1.asp Web page, and execute the page so that the query page and the display page are linked by the variable name; the name of the text box ts, remember, because For this is the variable name that you want to pass through the form, which is also used to display the page later.
Five, the production by the book name displays the webpage
1, a new Dynamic Web page, named Xianshi1.asp.
2, input Web page static display content, such as Figure 25, where "back" link to query page chaxun1.htm, red dotted line also indicates that this is a form.
3, set up a recordset. Select the Bindings tab in the Application panel, press the plus button, select the recordset (Query), eject the recordset dialog box, the settings in Figure 26, name Recordset1, database table Select Tushu, Filter filter condition is set to the field "book title" in Table Tushu to contains (contains) the passed formvariable (form variable) TS, the TS variable is the name of the text box in the query page chaxun1.asp. Click the OK button to return to the page.
4. Drag the recordset's fields to the appropriate location on the page, respectively.
5, select the second line of the table, click on the serverbehaviors tag in the application panel, press the plus button, select Repeatregion, Pop-up Repeat Region dialog box, set to show all.
The final page effect is shown in Figure 27.
At this point, according to the Book Name query Display page finally finished production, we look at the specific effect. Run PWS, use IE to open chaxun1.asp, enter a name, such as "Quality management", IE will automatically show all titles contain "Quality Management" books, the specific effect of Figure 28, 29. 8
Web page finally all finished, now we can complete the operation. The IP address of their own computer to tell colleagues, open PWS, so that colleagues can query the system at any time to query the book.