Following the previous two articles "ASP Knowledge Organizing Notes 1" and "ASP Knowledge Organizing Notes 2" , "ASP Knowledge Organizing Notes 3" is newly released:
17. Question: What is the difference between using ADO's AddNew method in ASP and directly using the "Insert into..." statement? Which way is better?
Answer: ADO's AddNew method only encapsulates the "Insert into" statement. Therefore, when operating on a large amount of data, directly using SQL statements will greatly speed up data access because it reduces the need for ADO "Translation" time, because the operations performed by the SQL statement are performed directly in the database server, which has significant advantages especially when the amount of data is large.
18. Question: Why do I use the standard insert record statement insert into books(name,email) values("kitty", "kitty@263.com in ASP) ") will go wrong?
Answer: SQL (Structured Query Language/Structured Query Language) is a data query language developed by IBM in the 1970s. It has now become the standard for relational database query languages. SQL statements are an English-based programming language that can be used to add, manage, and access databases.
Although you can use double quotes when adding a string in a SQL statement, single quotes are required in ASP for normal execution. So it should be written as insert into books(name,email) values(‘kitty’,‘kitty@263.com’).
19. Question: What are ActiveX controls? Where can I get these ActiveX controls?
Answer: Microsoft ActiveX controls are reusable software components developed by software providers. In addition to the embedded objects of ASP, the installed ActiveX controls can also be used in ASP, which can save a lot of valuable development time. In fact, there are also many ActiveX controls embedded in ASP that can be used.
Using ActiveX controls, special functions can be quickly added to Web applications and development tools. For example, use the AdRotator object to create an advertising scrolling board, use the FileSystemObject object for file access, and use the Marquee object to implement scrolling text.
Now, there are more than 1,000 commercial ActiveX controls. ActiveX controls can be developed using various programming languages, such as C, C, etc., as well as Microsoft's Visual Java development environment Microsoft Visual J. Once an ActiveX control is developed, designers and developers can use it as a preassembled component for developing client programs. Using ActiveX controls in this way, users do not need to know how these components are developed. In many cases, they do not even need to program themselves to complete the design of web pages or applications.
There are currently more than 1,000 commercial controls provided by third-party software developers. The Microsoft ActiveX Component Gallery stores relevant information and related links to various ActiveX controls provided by Microsoft and third-party developers. A list of companies developing Internet-enhanced ActiveX controls can be found in the Microsoft ActiveX Component Gallery.
20. Question: Why is the value of the starting site in the form obtained using the strStartPort=(Request.Form ("catmenu_0") statement not found in the database?
Answer: This is because the value of the starting site obtained may have spaces. For example, the original meaning is "Hangzhou", but due to the existence of spaces, the value obtained by the ASP program may be "Hangzhou", and there is only a record of "Hangzhou" in the database. , of course it cannot be found. The solution is to use the Trim function to remove all spaces at both ends of the string. The corresponding statement is:
strStartPort=TRIM(Request.Form("catmenu_0"))
21. Question: In ASP, when the life cycle of a variable ends, how many methods are there to retain the content of the variable?
A: Any operation that causes the end of the web page, such as pressing the browser's "refresh" button, or closing the browser and then reopening it, will cause the end of the variable life cycle.
If you want to retain the contents of variables when the web page ends execution for use in the next execution, you can use the Application object to achieve this. For example, you can use the Application object to create a counter that counts website visits.
The Session object is the same as the Application object. It can store the contents of the variable at the end of the web page. However, unlike the Application object, each connection is an independent Session object. Simply put, all online users will only share one Application. object, but each online user will have his or her own Session object.
The Application object and Session object can help us record information on the server side, while the Cookies object will use the Cookies function provided by the browser to record information on the client side. One thing to note is that cookies are information recorded in the browser, so data access is not as simple as accessing other ASP objects (the information is stored on the server side). In terms of actual operation, only when the browser starts browsing the server A certain web page, and the server has not downloaded any data to the browser before the browser can exchange Cookies data with the server.
22. Question: What should I do after using the object?
Answer: After using the object, first use the Close method to release the system resources occupied by the object; then set the object value to "nothing" to release the memory occupied by the object, otherwise the WEB service site will run due to too many objects. The efficiency is reduced or even collapses. The corresponding statement is as follows:
< % 对象.close set对象= nothing % >
The above is the freshly released "ASP Knowledge Organizing Notes 3", everyone is welcome to read it carefully.