See a lot of netizens recently asked some basic questions about database operation, now I have written a simple tutorial posted up, so that some beginners the fastest entry:
ASP and database application (for beginners)
Generally speaking, a real, complete site is inseparable from the database, because the actual application, need to save a lot of data, and these data are often associated with, using the database to manage the data, can be very convenient to query and update. There are many types of databases, such as the Fox database (. dbf), Access database (. mdb), Informix, Oracle, SQL Server, and so on, where I'll take a Microsoft Access database as an example of how the ASP accesses the database.
Common Database statements
1.SELECT statement: The command database engine returns information from the database as a set of records.
2.INSERT into statement: Add one or more records to a table.
3.UPDATE statement: Create an update query to change the value of a field in a specified table based on a particular guideline.
4.DELETE statement: Create a delete query to purge records from one or more tables that are listed from the FROM clause and that conform to the WHERE clause.
5.EXECUTE statement: For activating PROCEDURE (procedure)
Use ASP to do one's own address Book practice practicing bar ...
I. Establishment of a database:
Create a new table using the designer by creating an empty database named Data.mdb with Microsoft Access. Enter the following fields:
Field name data type description Other
ID AutoNumber data ID field Size: Long integer new value: Incremental index: (No Duplicates)
Username Text name default value
Usermail text e-Mail default value
View number viewing sub-number segment size: Long integer default: 0 index: None
Indate Time Date Join time default value
Save as a data.mdb file, just to make it easier to explain, but to do a relatively simple library.
Second, the connection database
Method 1:
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Driver={microsoft Access driver (*.mdb)};d bq=" &server.mappath ("Data.mdb")
Method 2:
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &server.mappath ("Data.mdb")
Note: A page, as long as the connection can be once, the database after use to close the connection in a timely manner.
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