ASP design FAQ and answer essence (3)

zhaozj2021-02-16  65

ASP design FAQ and Solution Equation 3

17. Problem: What is the use of ADDNEW method using ADO in ASP and uses "Insert Into ..." statement? Which way is better?

A: ADDNew method is just encapsulated "Insert InTo" statement, so when you operate a lot of data, you will have a speed of using the SQL statement directly accelerated the speed of access data, because it reduces ADO "translation "Time, due to the operation performed by the SQL statement is done directly in the database server, especially when the amount of data is large.

18. Problem: Why is I use the standard insert record statement in ASP INSERT INTO BOOKS ("Kitty", "Kitty@263.com") will be wrong?

A: SQL (STRUCTURED Query Language / Structure Query Language) is a data query language developed by IBM in the 1970s, which has now become a standard for relational database query language. The SQL statement is a kind of English-based programming, which can be used to add, manage, and access the database.

The string when adding in the SQL statement can use dual quotation marks, but in ASPs, single quotes can be used to perform properly. Therefore, it should be written into INSERT INTO BOOKS (Name, Email) Values ​​('Kitty', 'Kitty@263.com').

19, question: What is an ActiveX control? Where can I get these ActiveX controls?

A: Microsoft ActiveX control is a reusable software component developed by software providers. In addition to the ASP's embedded object, additional installed ActiveX controls can also be used in ASP, which saves many valuable development time, which actually embeds a lot of ActiveX controls in ASP.

Using ActiveX controls, you can quickly add special features in the development tool. For example, using an ADROTATOR object to make an ad scrolling board, use the FileSystemObject object to use the Marquee object to implement scrolling text.

Now, more than 1,000 commercial ActiveX controls have developed ActiveX controls, such as C, C , etc., and Microsoft Visual Java development environment Microsoft Visual J . Once the ActiveX control is developed, the design and developers can use it as a pre-assembly component for developing a client. Use the ActiveX control in this way, users do not need to know how these components are developed, in many cases, even do not need to program their own programming, you can complete the design of the web page or application.

There are more than 1,000 commercial controls provided by third-party software developers. The Microsoft ActiveX Component Library (ActiveX Component Gallery) has related connections, which point to the various ActiveX controls provided by Microsoft and third-party developers. In the Microsoft ActiveX Component Gallery, you can find a list of companies developing the Internet Enhanced ActiveX control.

20. Problem: Why use strStartport = (Request.form ("CatMenu_0" statement to get the value of the start site in the form in the database can't be found?

A: This is because the value of the starting site may have spaces, such as "Hangzhou", but because the space exists, the value taken by the ASP program may be "Hangzhou", and only "Hangzhou" record in the database Of course, I can't find it. The solution is to remove all the string two spaces in the TRIM function. The corresponding statement is: strStartport = Trim (Request.form ("Catmenu_0"))

21. Problem: After the life cycle of the variable in the ASP, how many methods for reserving variable content?

A: Any operation that causes the end of the page, such as pressing the "Refresh" button of the browser, or turn off the browser, reopen it, will cause the end of the variable lifecycle.

If you want to reserve the contents of the variable when executed on the web page, you can use the Application object when you use the application. For example, you can use the Application object to make a counter for statistical sites.

The session object is the same as the Application object, and the contents of the variable can be stored at the end of the page, but the Application object is different, each online is an independent session object, simply that all online Internet users will only share an Application Object, but every online Internetony will have its own session object.

Application objects and session objects can help us record the information on the server, and the cookies object will record the information in the client with the cookies feature provided by the browser. One point to note that cookies is recorded in the browser, so the access is not as simple as accessing other ASP objects (information stores in the server side), as far as actual operation, only in the browser starts to browse SERVER A web page, and Server has not downloaded any data to the browser, the browser can exchange the cookies data with Server.

22, question: What should I do after the object is used?

A: After using the object, first use the Close method to release the system resources occupied by the object; then set the object value "nothing" to release the memory occupied by the object, otherwise it will cause the Web service site operational efficiency and even because the object is too much. Crash, the corresponding statement is as follows:

<%

Object .close

SET object = Nothing

%>

转载请注明原文地址:https://www.9cbs.com/read-23264.html

New Post(0)