17. Question: What is the difference between using ADO's AddNew method in ASP and directly using Insert into... statements? Which method is better?
Answer: ADO's AddNew method just encapsulates the Insert into statement, so when operating a large amount of data, directly using SQL statements will greatly speed up the access of data, because it reduces the translation time of ADO. The operations performed by SQL statements are performed directly in the database server, especially when the data volume is large, it has significant advantages.
18. Question: Why does it make an error if I use the standard insert into books(name,email) values(kitty, [email protected]) in ASP?
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 language. SQL statements are an English-based programming language that can be used to add, manage and access databases.
Although strings added in SQL statements can be used with double quotes, single quotes are required in ASP to execute normally. Therefore, it should be written as insert into books(name,email) values('kitty ','[email protected] ').
19. Question: What are ActiveX controls? Where can I get these ActiveX controls?
A: 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, many ActiveX controls are embedded in ASP.
Using ActiveX controls, special features can be added to web applications and development tools very quickly. For example, use the AdRotator object to create an ad scrolling board, use the FileSystemObject object to access files, and use the Marquee object to implement scrolling text.
Now, there are more than 1,000 commercially available ActiveX controls, and the development of ActiveX controls can use various programming languages, such as C, C++, etc., as well as Microsoft Visual Java development environment Microsoft Visual J++. Once the ActiveX control is developed, designers and developers can use it as pre-assembled components for developing client programs. Using ActiveX controls in this way, users do not need to know how these components are developed, and in many cases, they can complete the design of web pages or applications without even programming themselves.
Currently, there are more than 1,000 commercial controls provided by third-party software developers. The Microsoft ActiveX Component Gallery contains information and related connections, which point to various ActiveX controls provided by Microsoft and third-party developers. In the Microsoft ActiveX Component Gallery, you can find a list of companies that develop Internet-enhanced ActiveX controls.
20. Question: Why is the value of the starting site in the form used to use the strStartPort=(Request.Form (catmenu_0) statement to get the value of the starting site in the form but cannot be 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 because the space exists, the value obtained by the ASP program may be Hangzhou, and there are only records of Hangzhou in the database, so of course it cannot be found. , The solution is to use the Trim function to remove all the spaces at both ends of the string, and the corresponding statement is:
strStartPort=TRIM(Request.Form(catmenu_0))
21. Question: In ASP, when the life cycle of a variable ends, how many ways are there to retain the content of the variable?
Answer: Any operation that causes the end of a web page, such as pressing the refresh button of the browser, closing the browser, and then opening it again, will lead to the end of the variable life cycle.
If you want to retain the content of the variable when the web page is executed at the end, you can use the Application object to achieve the next execution. For example, you can use the Application object to create a counter that counts the number of website visits.
The Session object is like the Application object. It can store the content of the variable at the end of the web page. However, unlike the Application object, each online 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.
Application objects and Session objects can help us record information on the server side, while Cookies objects will record information on the client side with the help of the cookies function provided by the browser. One thing to note is that cookies are information recorded in the browser, so the access to data is not as simple as accessing other ASP objects (information stored on the Server side). In terms of actual operation, only when the browser starts browsing the Server The browser can exchange cookies data with the Server before the Server downloads any data to the browser.
22. Question: What should I do after the object is used?
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 operation efficiency of the WEB service site will be reduced or even crashed due to too many objects. The corresponding statements are as follows:
< %
Object.close
set object= nothing
% >