Using Dreamweaver mx to build a simple book query system (1)

Source: Internet
Author: User
Tags dsn odbc dreamweaver
dreamweaver| Query System

Recently, in order to make full use of book resources to facilitate staff inquiries, the company decided to establish a book query system on the intranet. 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. Therefore, I use the Web page to make a sharp weapon Dreamweaver Software (hereinafter referred to as DW), the database with acess, the Environment for WIN98,PWS (Editor Note: On the PWS of the use of the tutorial can be read "In-depth understanding of Microsoft Personal Server PWS," "In-depth understanding of Microsoft Personal Server PWS the second "In-depth understanding of Microsoft Personal Server PWS three" "in-depth understanding of Microsoft Personal Server PWS four." The gong is officially started below.

First, create a database:

   One,Under my document, create a new folder named "Research Institute". Of course, you can also create new names elsewhere.
   Second,Open acess, create a new database DB1, create 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.
   Third,Enter individual 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 under the new site, pop-up settings site panel, station named Input Institute, directory is the directory we have just established, as shown in the 1,testing server option in the server model select ASP VBScript, Access selects Local/network.

Figure 1

(2) Create a new page, because the query is a dynamic page, so select dynamic page and ASP VBScript in the pop-up panel, as shown in Figure 2. Press the Create button to return to the page.


Figure 2

(3) connecting to the database. Expand the application panel on the right, select the Databases tab, press the + button, and select Data Source Name (DSN), as shown in Figure 3.


Figure 3

(4) On the pop-up data Source Name (DSN) panel (Figure 4), select Define ... button to enter the ODBC data Source Manager, select the System DSN tab, click the Add button, select the "Driver do Microsoft Access (*.mdb)" Data driver, and click the Finish button.


Figure 4

(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.


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 Source Name (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.

Figure 6
   now all ready to work, you can build dynamic query page.
   One,Create a home page. 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.

Figure 7
   Second,Create a query page by book category.
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.

Figure 8
Figure 9 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.

Figure 10
5, click on the binding label next to the "+" number, expand the field, with the mouse hold "category name" field, drag directly onto the page cell, release the mouse, so that the cell contains a dynamic text, the page effect as shown in Figure 11.

Figure 11
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 server behaviors tag, press the plus button, select the Repeat Region (circular area), so you can control how many records a page display. Here, because there are not many categories of books, in the dialog box, select All Records (Show All Records), page display, as shown in Figure 12.

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. Please look forward to the introduction of the following content!

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.