Chapter 3: Applying Database to Create Dynamic Web Pages
Section 3: Display database records
It's finally time to show the power of Dreamweaver Ultradev. First, let's take a look at how to use Ultradev to realize the data display function. It's very simple, just follow me.
After we created the data set last time, the following display appeared in the Data Bindings panel:
Then we create a table with 2 rows * 6 columns. The number of columns is determined by the number of fields in the data table. As for why there are two rows, you will understand after reading. After filling in the necessary information, the page will look like this:
The next work is very simple. Select the field name that appears in the Data Bindings panel, drag and drop it into the table we just created. The effect is as shown in the figure, which means that we want to display the database in the corresponding cell. The value of a field. But this is not enough. One step is needed to display all the records in the database.
Select the row we just dragged and dropped the field into, the effect is as shown in the figure:
Switch the panel to Server Behaviors, and our protagonist is about to appear. We need to apply some actions to these data to make them obey our words and display them as we want. Select Repeat Region:
The next dialog box asks you how many records to display on one page. When there are thousands of records in your database, it is impossible for us to display them all, which will slow down the loading speed of the web page. Generally, the data is displayed in the form of paging, and the Repeat Region behavior is used. . Here we choose to display 3 records per page.
After clicking OK, as shown in the figure:
Let's switch to the browser window and view the program we just generated. Oh, don't forget to save this page as the default document name you set in the Internet Information Services Manager, here is default.asp. Enter http://localhost in the address bar of the browser window and you will see the following effect. Haha, aren't you very excited? The data in the database is displayed before our eyes. You also find that it is not difficult to create a Web application. Well, I was happy for a while, and I seem to have found something wrong, right? By the way, only 3 records are displayed here, and we just entered 5 records manually in our database. What about the others? Okay, let's go ahead and refine our program.