Create a simple access database for the webpage

Source: Internet
Author: User
Open MicrosoftAccess, select File> Create Database, and then select a location to save your database file. Here we save the file according to its default db1.mdb name. After saving the database, we can see the following interface. Double-click the designer to create a table. You only need to follow the steps to apply the application here,

Open Microsoft Access, select File> Create Database, and then select a location to save your database file. Here we save the file according to its default db1.mdb name. After saving the database, we can see the following interface. Double-click the designer to create a table. You only need to follow the steps to apply the application here,

Open Microsoft Access, select File> Create Database, and then select a location to save your database file. Here we save the file according to its default db1.mdb name.



After saving the database, we can see the following interface. Double-click the designer to create a table. You only need to follow the steps to implement the application here. Even if you have never touched the database before, there is no problem. If you want to implement deep-level applications that involve relational structures, you 'd better find a database book.



Next, we will design a user information table for user registration. Double-click the designer to create a table. The design page is displayed. Enter the user information you want to record in the field name column (it is recommended that the Field name should not be named in Chinese, so that there will be no too much trouble in programming in the future, at the same time, be sure not to use the reserved words of the database itself, such as temp, which may conflict with the database program. Try to use the table name + slide line + name, such as tbl_userinfo_name, here we first use a simple name for processing ). We have created six fields: username, userpass, and usermail), reg_date (user registration time), homepage (user's Personal homepage Address), and phone (user's contact number ). The default text type of the data type is used. The field size is 50. First, we can process individual fields.

Generally, the username, password, email address, and contact number cannot exceed 50 characters (of course, if someone maliciously enters a long string, an error is returned, so we need to make some restrictions in the production of web pages), and personal home address, it may exceed --- such as http://www.netease.com /~ Cosix/html/... so we adjusted its field size to 200.



The time type of the registration date is changed to date/time, * _ 'Of course. Then, we can call the function of access to add a default value = Now (). This indicates that when data is added, the database system automatically uses the current time of the server as the value of the reg_date field, in this way, we can save the step of entering the registration date on the webpage.



After the modification, click Save chart on the toolbar to save the newly created table. A warning dialog box is displayed, indicating that the table has no primary key defined. If there is no primary key, you cannot determine the unique position of the record in the table. In this case, a mistake occurs when you delete or edit the record. Therefore, we need to create a primary key. The values of the primary key are not repeated. Click Yes to create a primary key.



A primary key named ID (with a key icon next to it) is created. The data type is automatically numbered.



Click "save". This time, enter the name of the table to be saved. We will name it userinfo.



A table is created! Is it easy?



Because we have not learned how to create the content for adding records, we will manually add some content here to facilitate our testing later ..



Well, a complete database is built up. What will we do next? Well, let's look at the next decomposition.

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.