Database File calling in ASP development (1)

Source: Internet
Author: User
Introduction
This article describes the "database file calling", the most basic and critical part in ASP Programming, and describes some tips for calling database files in ASP Programming.
ASP introduction
ASP (Active Server Pages) is a Web application development technology launched by Microsoft in 1996. It is a combination of script language, ActiveX component, and HTML language, microsoft describes it as "a server script environment where dynamic, interactive, and high-performance Web server applications can be generated and run ". Its main function is to provide a powerful method or technology for generating dynamic and interactive Web server applications. The characteristic is that commands and scripts are interpreted and executed on the server, and the content sent to the client browser is only a standard HTML page. The advantage is that the program design is easy to understand and convenient. ASP is widely used in China, and a considerable number of dynamic websites use ASP technology.
ASP database file call
Although different systems may install different database drivers, generally server systems support IIS4.0/5.0, therefore, there are at least three database drivers on the Server system, including Microsoft Access Driver, Microsoft ODBC for Oracle, and SQL Server. Therefore, the Server system can use at least three types of databases, including Access, Oracle, and SQL Server, to design ASP web databases. Microsoft Access 97/2000 is one of Microsoft's Office series and has similar interfaces with Office Series Software. Therefore, this article is intended for beginners, use Access database files for ASP Programming.
Create a database file (friend. mdb) as shown in Figure 1 through the Access application)
In ASP Programming, there are two ways to call the database file: one is to manually set the file directly on "data source (ODBC)" in "control panel; another method is programming. Database files are called through relative paths. This method can be applied to any server without any further configuration. The first method is relatively simple and secure. This article describes the second method.
The following describes how to read table records in database files in ASP Programming:
01: <HTML> <BODY>
02: <! -- # Include file = "adovbs. inc" -->
03: <%
04: 'Use ASP Connection object to open the database. The database file is <Friend. mdb> 'in the figure above'
05: Dim objConn
06: Set objConn = Server. CreateObject ("ADODB. Connection ")
07: objConn. ConnectionString = "Provider = Microsoft. Jet. OLEDB.4.0 ;"&_
08: "Data Source =" & Server. MapPath ("Friend. mdb ")
09: objConn. Open
10: read the records of the "data" table and store them in the Record set object.

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.