(http://pcit.diy.myrice.com/jiaochueng/asp/4-2.htm)
Preface:
How to establish a connection through the ASP and database is a very realistic issue, I try to write very detailed. I believe this article believes that you have been able to write similar relatively simple and practical programs.
(1) Selection of databases:
There are many databases you can choose, SQL Server, Access (*. MDB), Excel (*. Xls), FoxPro (*. Dbf) or even ordinary text files (* .txt) can achieve the function of storing data. So what database is the most appropriate? Where SQL Server is server-level, enough to cope with tens of thousands of visits per day. Access97 is recommended for non-server-level database recommendations. Because: (1) As long as PWS or IIS4 is installed, the ODBC driver of Access is installed, that is, your system will definitely support access to the Access database. (2) The SQL instruction supported by Access is very complete. (3) The Access ODBC driver is very efficient. Although it is not a server-level database, it is still more than enough database support as a small and medium-sized enterprise. (4) Access 97 is in office97, it is very convenient to get and use.
This article is based on the Access database to introduce Web-based data inventory method.
(2) Example: We build a "customer" database, you need to save the following customer information: customer name, contact name, city, phone number.
(1) First establish an Access database Customer.mdb (useful in the future). Established the following field: customer name, contact name, city, phone number, customer number, time. Save the table as "customer" (in the future, ===> Look at the map). Note: 2 (customer number, time) when establishing a field, because they are used in the future. It is recommended that it is best to add these two items in the future, and it will not be useless. In addition, Access will ask if the Access will ask if you build a keyword, we don't have to build it. Also: The "default value" of the time field is "now ()", that is, the time to go to the system. At the same time, the index entry is set to "have (allowed repetition)", the meaning: the web is highly possible to access data at the same time, so it is allowed to repeat, the index is set to "have" can speed up the sorting speed. ===> Look at the picture
(2) Establish a submission form Add.htm:
The source code is as follows:
Add Database Record font> p>