dreamweaver| Design | data | database
Chapter III Design and connection of doking ' s BLOG database
After building a good development environment, Doking's blog database planning is the third step, it is also directly related to whether the database can be effectively run after the key steps, but also to a database developer specification requirements.
3.1 Normalization of the database
The normalization of database is mainly embodied in the relationship between table and table, data structure and storage.
3.1.1 The relationship between data tables
Many beginners often think that building a table to store all the data is OK. If that is the case, that often results in data redundancy. Figure 3-1-1 is a datasheet that lets you see that the data in the red circle is redundant.
Figure 3-1-11 data tables
Redundant data can affect the efficient operation of the database and even push the database to ruin. In order to reduce redundant data, the data should be stored separately into several tables, and the connection between table and tables should be established. Table and the connection between the table, mainly a one-to-many, Many-to-many, a pair of 13 ways.
A one-to-many relationship, which is the most common type of relationship in a database. This relationship is called the parent table and the child table relationship or the primary table and the table relationship. Figure 3-1-2 embodies a parent table and child table relationship. Here, the topic table and reply form is a one-to-many relationship. The topic table is the parent table, the reply table is a child table, a row in the topic table can have 0 rows, one line, or many corresponding to it, and each row in the reply table corresponds to the corresponding topic in the topic table.
Figure 3-1-2 a One-to-many relationship
Many-to-many relationships, where each row of the first table corresponds to many rows in the second table, and each row in the second table can correspond to many of the rows in the first table. For example, a topic can have many user replies, and a user can also make multiple thematic responses. This requires creating a third table that connects the topic code to the user code, which is the parent table of the first two tables. In Figure 3-1-3, the reply table is the parent table of the topic table and the user table.
Figure 3-1-More than 3 many-to-many relationships
A one-to-one relationship is the connection of a row in one table to a row in another table. This relationship is very rare, because if so, it would be more reasonable to put the two tables together as a single table.
3.1.2 Data structure and storage
The physical structure of a database must be based on a logical structure, and some rules need to be memorized when designing tables, fields, and relationships. The order of rows and columns does not work, although in a datasheet the columns have a certain ordinal position, but they do not represent the order of references. The order of the records only works if they are taken out of the datasheet and sent. SQL uses the parameter database index to process the order in which records are extracted. For example, in a datasheet, it's fine to put a sex field before the last name segment, as long as you're calling the datasheet in an SQL statement, remember to call the first Name field before the sex fields.
When designing a datasheet, assign the field size carefully and, if sufficient, can save the province. If the field is used to store integers, use integers or long integers without single or double precision, and if sufficient, create a 100-character text Type field instead of a memo field. Why? If you are not afraid of high server costs, do not fear that the network database running slow, you can not ignore these, but it is the most serious cause database crashes.
Design of 3.2 doking ' s blog database
Based on the above database normalization knowledge, this section begins to plan and design the doking ' s blog database. Doking ' s blog database designed five data tables, respectively, LM table (column table), ZT table (Learning Note table), HF table (reply table), YH table (user table), gly table (Administrator table), and the database named "Dkblog.mdb", Saved in "D:\dat\" Table of Contents.
LM table is the column table, for the site navigation bar to establish and learn the classification of notes, column content is designed by the webmaster, the field design as shown in Figure 3-2-1
Figure 3-2-1 LM table field design diagram
The ZT table is the Learning Note table, which is used to store the user to publish the learning experience, in fact, the field design as shown in Figure 3-2-2:
Figure 3-2-2 The ZT table field design diagram
The HH table is a reply form that stores the responses of the user to the published learning notes, as shown in Figure 3-2-3:
Figure 3-2-3 HF table field design diagram
The YH table is the user's table, which stores the user's registration information and facilitates the user's login to post learning notes and learning notes. Its field design is shown in Figure 3-2-4:
Figure 3-2-4 yh table field design diagram
Gly table is the Administrator table for administrator login, admin site, its field design such as Tutu 3-2-5
Figure 3-2-5 gly table field design diagram
3.3 Create doking ' s blog database connection source
(1) Start Dreamweaver MX 2004, on the File menu, select New, in the New dialog box, select the category as Dynamic page, select dynamic page as "asp.net VB", press "create" button to create a Dynamic Web page.
(2) switch to the Applications panel, select the Database tab, click the + sign, and select OLE DB connection, as shown in Figure 3-3-1:
Figure 3-3-1 Select OLE DB connection
(3) In the pop-up OLE DB Connection dialog box, enter the connection name "Dkconn" and click the "Build" button, as shown in Figure 3-3-2:
Figure 3-3-2 Setting the connection name
(4) Enter the data Connection Properties page, select the Selector tab, and because the database you want to connect to is a Access2003 database, select Microsoft Jet 4.0 OLE DB Provider as the driver in the database engine. As shown in Figure 3-3-3:
Figure 3-3-3 Select Database Engine
(5) Select the "Connection" tab, choose to connect the database to "D:\dkblog\dat\dkblog.mdb", the "username" and "password" text box empty, such as Figure 3-3-4
Figure 3-3-4 Select Connection Database
(6) Select the "Advanced" tab, and in setting access, select "ReadWrite", as shown in Figure 3-3-5
Figure 3-3-5 Setting access permissions
(7) Return to the "Connection" tab, click the "Test" button, appear as the Figure 3-3-6 dialog box, which means that the database Dkblog.mdb connected to the site. Click the OK button to complete the connection work for the database. Below the root of the site, you can see the addition of a new file, "Web.config," where you can later modify the connection directly to the database.
Figure 3-3-6 Database Test dialog box
The "Build" button in the 3.4 Connection dialog box is not resolved
If you click the Build button in the Step (3) of section 3.3, the Data Link Properties dialog box does not open. There is no reaction when you click the "Build" button. One cause of this problem may be that MDAC 2.8 is included by default in MDAC 2.8;xp SP2. XP SP1 users are also affected by this problem if they have MDAC 2.8 installed. This issue only affects Dreamweaver MX 2004 and has no effect on Dreamweaver mx. There are two ways to fix this:
The first method: in the Step (3) of the steps in section 3.3, enter in the connection string text area in the OLE DB Connection dialog box:
Provider=microsoft.jet.oledb.4.0;datasource=d:\dkblog\dat\dkblog.mdb; Persist Security Info=false
The second method is to create a new text file on your hard disk, and change the file's extension to. udl, and then open the. udl file. The file can open the Data Link Properties dialog box. Its specific operations are as follows:
① the steps in section (3) of step 3.3. Execute start | All Programs | accessories | Notepad system menu commands.
② in the Notepad main window, execute the File | Save menu command directly, and the input file name in the Save dialog box is the database connection. UDL, as shown in Figure 3-4-1.
Figure 3-4-1 Saves the database connection. UDL
③ Click on the "Save" button, close the Notepad program, switch to the "desktop", double-click the "Database connection" file, according to the tutorial in paragraph (4)-(7) to operate. Click the OK button to close the Database Links dialog box.
④ Execute "Start" | "All Programs" | "Accessories" | "notepad" system menu commands. In the Notepad main window, execute the File | Open menu command directly and select Database connection to open the file.
⑤ in the Notepad main window, select all the characters in the third line to copy, as shown in Figure 3-4-2. Switch to the Dremweaver program and paste it into the connection string text area of the "OLE DB Connections" dialog box (3), which completes the database link in Dreamweaver.
Figure 3-4-2 Copy all characters in the third line of the database connection file
Turn from: Dynamic Network production guide www.knowsky.com