Author: Pan Lei
Summary: This article describes the role and characteristics of ASP technology and its application in e-commerce.
Key words: ASP; e-commerce.
I. ASP Technology ASP (Active Server Pages Dynamic Web) is a technology that Microsoft introduced to replace CGI (Common Gateway Interface General Gateway Interface). Currently, many Windows-based Web sites on the Internet have begun to replace CGIs in an ASP. Simply put, ASP is a script running environment in the server side. With this environment, users can create and run dynamic interactive web server applications, such as interactive dynamic web pages, including collecting and processing information using HTML forms, uploading Download, etc. Typically, users who see from the browser are mostly static. Many sites on the Internet, still provide "static" home page content. The so-called "static" refers to the main page content of the site is "fixed". When the browser provides the contents of the home page with the Site Server (Web Server), the browser is required to provide the home page, and the Site server receives the designed static HTML file data to browse. . A "static" site, to update the contents of the home page, must manually update its HTML file data. With the development of web applications, users want to see the home page that is dynamically generated as required, such as responding to the request of the user, generates a report, etc. When filling the input data of forms (FORM) on the browser to provide HTTP requirements, the application can be performed in the site server, not just an HTML file. The site server receives the required application, analyzes the input data of the form (Form), and transmits the result to the browser in HTML format. The traditional methods of generating dynamic homepages are cgi, isapi, etc. according to user requests to generate dynamic homepages. The CGI is an activation response process based on the HTTP request of the browser side, each requesting a process. When there are many requests, the program crowds system resources, resulting in low efficiency; ISAPI is improved for this shortcoming, using DLL (dynamic link library) technology to thread replace the process, improve performance and speed, but consider synchronization of threads Problem, and development steps are cumbersome. There is still another problem with the two technologies and another universally used development dynamic webpage, that is, development difficult, program development and HTML writing are two completely different processes, requiring specialized programmers to develop. More simple development technologies such as JavaScript and Idc (Internet Database Connector) are limited, not for use. ACTIVEX technology used by ASP is based on open design environments. Users can join themselves to join, so that their dynamic webpages have almost unlimited expansion capabilities, which is far from which traditional CGI and other programs are far less. ASP and common technologies in the Client side, such as Java Applet, ActiveX Control, VBScript, JavaScript, etc., the commands and Script statements in the ASP are interpreted by the server, and the execution result generates a dynamically generated web page and Send it to the browser; the script command of the Client end technology is interpreted by the browser. Since the ASP is interpreted on the server side, developers can consider whether the browser supports ASP; at the same time, because it is executed on the server, the developers don't have to worry about the downloads of others to steal programming logic.
The ASP is implemented by an ASP file named .asp, one .asp file is equivalent to an executable file, so it must be placed under the Directory of executable permissions on the Web server. When the user enters the .asp file from the browser, the browser issues this URL request to Web Server if the web server is installed, and the ASP is called. ASP reads the corresponding .asp file, interprets and executes commands, dynamically generates an HTML page to return to Web Server, then the web server is sent to the browser. The production of the ASP file is similar, and the HTML development is integrated. It can be done in the same process. Use the ASP to embed the script that can be executed into the HTML file (change the HTML file to .asp), which makes the HTML file Writing is integrated with the development of scripts. With an ASP built-in object, server components can complete a very complex task, and users can develop or use others to develop a dedicated task. The ASP comparison gateway and server extension mode have the following advantages: (1) Complete with the HTML file;
(2) Easy to create, do not require other compilation, link programs;
(3) Object-oriented and expandable through the ActiveX Server object.
Second, e-commerce data access
E-commerce refers to an electronic approach to an electronic approach and a coordination of materials and personnel processes in the network, in order to commercial exchange activities. In the e-commerce system, the web provides an effective means of communicating with customers. Using web technology, implement the connection of web servers and database systems, complete processing and queries for data, users can query by using easy-to-learn browsers Processing the various data required. There are generally two ways to achieve web server and database: one is to establish connection and communication between the two intermediate parts, such as CGI (General Gateway Interface) and API (App Programming Interface). The web server implements the interaction with the web browser by calling the CGI program. That is, the CGI program accepts the browser to send it to the web server. After processing, the corresponding result is sent back to the web server, and the information is transmitted to the browser via the web server. However, the CGI program has a greater limitations in response speed and resource utilization, and the client requests a CGI program. The server opens a process. When the number of requests is large, it is easy to cause bottlenecks, and developers often use API programming. To extend server function, API program accounts for less system resources, high running efficiency, but its programming is more complicated than CGI programs; the other is to access Web via browser by browser's Java applet (Java applet) The database on the server uses the JDBC (Java Database Connectivity technology, which implements access to Web Server through the API provided by JDBC. Due to the limitations of the Java Applet itself, most applications are based on middleware technology. The ASP is also a mode that belongs to the middleware, but it has a big advantage on the Windows platform and the gateway and server extension mode. The biggest feature of the gateway is that its platform is independent, but the gateway program is usually more difficult to write and change. The gateway program is usually a separate program that is not integrated with the HTML file, which requires a separate application with languages such as C, C , VB, Perl, and the ASP application changes this. Using ASP can not only read the database of Access and SQL Server, but also read other ODBC (Open Database Connect Open Database Interconnect) compatible databases. Accessing the database in ASP is implemented by ADO (ActiveX Database Object Active Data Object) and transaction. ADO is a way to operate the database supported by Microsoft, which is an easy to use and scalable technology to add database access to the web page. The use of ADO objects is similar to the DAO (data access object), RDO (remote data object). In ASP, ADO can be considered as a server component, it is simple to say, it is a series of objects that apply these powerful objects, you can easily complete the database complex operation. Third, the application of ASP in e-commerce
In e-commerce, for users, the purpose of the online information query is to find the products or services they need, and for goods or service providers, their destination is to sell their own products or services to users. Therefore, let users query the backend database through the browser's back-end database is the necessary services that many web service providers, and the ASP implements this through the built-in AdoDB components. ADO can be used to write compact scripts to connect to ODBC compatible databases and OLE DB compatible data sources. The specific steps can be summarized as follows:
1 Creating Database Source Name (DSN) AdoDB works through ODBC, so set DSN (data source name) in ODBC. Open Windows "Control Panel", double-click the "ODBC" icon, then select the "file DSN" property page, click
3 Creating a data object ADO usually saved query results. Recordset is the most complex object in ADO, with many properties and methods, flexible use, can achieve a lot of good results. Its creation method is as follows: set recordset = connection.execute (sqtstr) creates and opened the object RECORDSET, SQTSTR is a string that represents a standard SQL statement. For example: SQLSTR = "SELECT * FROM B1" SET RECORDSET = Connect.execute (SQLSTR) After this statement is executed, all records in B1 are saved in the object RECORDSET.
4 Operating databases can easily perform data insert, modify, delete, etc., using Execute. If the insertion operation is performed: sqlstr = "INSERT INTO B1VALUES (1, 2)" Connect.execute (SQLSTR)
5 Close the data objects and links After using the ADO object, be sure to turn off the data objects and links. Closing by calling method close in ASP. Close the created data object: Record set .close set record set = Nothing Close the created link object: Connect. Close Set Connect = Nothing Complete Program Segment: <% setConnect = Server.createObject ("AdoDb.Connection") 'Generate Components Example Connect.Open ("DSN = DSNNAME; UID = UserID; PWD = Password") 'Connect Database SQL = SELECT * FROMTABLENAME SETRS = Connect.execute (SQL)' Execute Query%> <% Dowhile Not Rs.eof%> ' The result of the result <% = rs (fieldname)%> <% rs.movenext loop%> The above is the whole process of accessing the database with the ASP, because the application is object-oriented, all operations are relatively simple, and the user needs to pay attention to the data structure. Understand, the current object of the object and object, etc., as long as you have a clear understanding, add the ASP powerful function, use the database on the network, to exchange information between users and the page, no longer It's hard. Conclusion: With the development of Web technology, intranet-based e-commerce systems are undoubtedly more applying for traditional business, how to use the high data access efficiency and transaction skills in this electronic business, still the current people. Concerns.