Dreamweaver build Web Query System 2

Source: Internet
Author: User
Tags format definition contains modify query dreamweaver root directory
dreamweaver|web| Query System

After the first few sections of the production, the site preparatory work has been preliminarily completed, this section is built to start building 114 of each page. The arrangement of the paging file is

such as:
Top_114.asp: Is the top of all pages, located under the site root directory under the/common folder;
Buttom.htm: Is the bottom of all pages, also located under the site root directory under the/common folder;
The above two files are included in the corresponding page through ASP's include command, so the purpose is to make the website modular and reduce the workload.

Index.asp:114 's homepage
Search.asp: Phone number query results page;
Seek_tel.asp: Query the form, because each page contains the query part, so this section also makes a separate file by other packages

Containing
Login_tel.asp: Fill in the online registration page;
Disp_tele.asp: Display believe the information page, the page contains the telephone number, the number corresponding unit, the unit introduction and so on;
login_ok.asp: Online Fill out the page displayed when the registration is complete;

Here you only need to pay attention to typesetting skills, the others are not too much. In addition, to access these pages in the form of HTTP, you

is http://localhost/114/index.asp to see the homepage.

First, establish a database connection

In the fourth step, our site has been established. Before constructing a dynamic page, we first build and data in the Dreamweaver MX

The connection between libraries, follow these steps:
1. Select the database project in the Application tab and click the Plus button and select "Custom connection string", as shown in Figure 6-1:

2. In the Data Source Settings dialog box, enter the data source name and the connection string, respectively. The connection string is used to connect to the database, where I

First enter in the absolute path format: "Driver={microsoft Access Driver (*.mdb)};d Bq=e:/pcitw/db/cy114db_2004.mdb"
3, here should be noted that all the content within the quotation marks must be written in the format, the database path and file name according to the actual situation

Fill in as shown in Figure 6-2:

After the above 3 steps, the database connection is established. Now look at the database panel, you can display the structure of the database. As shown in Figure 6-3:

The establishment of a database connection essentially creates a connections folder in our root directory and creates a

An ASP file that has the same name as the data source we specified. Familiar with the ASP's friends will be able to see immediately, inside the original is a variable definition. Page is: mm_db114_string = "Driver={microsoft Access driver (*.mdb)};d Bq=e:/pcitw/db/cy114db_2004.mdb" If we

Upload to the site, then this code can be modified, otherwise it is not connected to the database. How to modify, we will explain in the future. As shown in Figure 6-4:

At this point, we have established a connection to the database, any future operations, as long as the database involved, will use the connection just established. Of course, if your site requires a lot of databases, then you will build multiple database connections. Because a connection can only correspond to one database.

Second, convert the index.asp into a dynamic page

Starting with this section, we will gradually convert the static page that we created earlier into a dynamic page that combines it with the database to complete our final page.
First we need to convert the homepage to a dynamic page. On the home page, only the "Value Recommendation" section on the right side needs to read the data from the database, so our goal is to read the records from the Tele table in the database with a Is_good field value of 1 and show it in descending order.
OK, get to work. Step 1th, set up the dataset. In the Bindings panel, select the Recordset (query) menu and in the dialog box as shown in Figure 6-5

Select the appropriate content. Now that the dataset is set up, the bindings panel already shows the fields of the datasheet. In step 2nd, drag the company name onto the page to display the field contents in the page. Refer to Figure 6-6:

So far, we've shown a record in our database on a Web page, but our goal is not to display a single record, but to display 10 records. Therefore, we also construct a repeat region behavior that will only be able to display the number of records we specify in the Web page. To construct a repeat region behavior, select Repeat region in the server Behaviors panel and, based on figure 6-7, note that you must select the table row you want to set when you select the repeat region behavior, which is the <tr> part of HTML.

Finally, we set up but click on an enterprise should display a detailed page of the connection, that is, call disp_tele.asp display phone number corresponding to the enterprise or individual details, where we are passed through the form of ID parameters to the disp_tele.asp page. Select the dynamic text on the page and enter the following in the Address bar: DISP_TELE.ASP?COMPANY_ID=<%=RS_CZTJ ("id")%>, as shown in Figure 6-8:

Second, convert disp_tele.asp and right_114.asp to dynamic pages

God, I just got the news, November 5, the supply of heating, I still have a few days. Pain, Ah!
Today to talk about the construction of the disp_tele.asp page, the function of this page is to display detailed business or personal data. Page features are not very complicated, let's go!
Here, we first agree that the call format for this page is: "disp_tele.asp?company_id=&hy_id=" to display the phone number while displaying the details of the enterprise's industry-recommended enterprises. We do not need to Dreamweaver MX from the go to the detailed page behavior, we are manually fill in the code.
First, construct a recordset in the page to display the specified phone number for the enterprise details, note the URL parameter section, see Figure 6-9:

After the recordset is established, drag the field to the appropriate position in the page. To display the field contents.

Then, the recommended enterprise Recordset that corresponds to the construction of the relevant industry category. This section modifies the right_114.asp file because it is saved as a separate Web page. This step involves using the Advanced Recordset Definition dialog box and filling in some of the code manually. See Figure 6-10:

Drag the company name onto the page and create a repeat area behavior. Finally, manually modify the Dreamweaver MX generated code to have the value of the recommendation when no category parameters are displayed. Modify the content See Figure 6-11:

Description, where the yellow part is the modified location.

OK, after the above modification, regardless of whether the call parameters are provided hy_id will display the corresponding super recommendation according to our intention. That is, if there are no parameters, all the recommendations (the first 10) will be displayed, and the first 10 of the corresponding categories, if available.
The end of this section is here to remind you that the Dreamweaver MX generated code is best studied. Do not expect Dreamweaver MX to automatically generate a website for you, you do not have to change a line. There's no such thing as that.

Previous Page



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.