This is the second note on asp collation.Only by figuring out the most basic issues,In order to better learn ASP programming.

Following the last two"Asp knowledge finishing notes 1"with"Asp knowledge finishing notes 2""Asp Knowledge Arrangement 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?A:The addnew method of ado just encapsulates the "insert into" statement,Therefore, when operating on a large amount of data,Using SQL statements directly will greatly speed up the access to data,Because it reduces the "translation" time of ado, because the operations performed by the sql statement are performed directly in the database server,There are 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","[email protected]") Go wrong?

Answer:sql (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.The sql statement is a programming language based on English,You can use it to add,Manage and access databases.

Although you can use double quotes when adding strings in SQL statements,But asp needs to use single quotes to execute normally.So 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 in asp,In addition, the installed activex control can also be used in asp, which can save a lot of valuable development time,In fact, a lot of ActiveX controls can be used in ASP.

Using activex controls, you can quickly add special features to web applications and development tools.For example, using an adrotator object to make an ad scroller,Filesystemobject for file access,Use a marquee object to implement scrolling text.

At present, there are more than 1,000 commercial activex controls. Developing 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 a pre-assembled component,Used to develop client programs.By using activex controls in this way, users do not need to know how these components were developed,In many cases,You do n’t even need to program it yourself,You can complete the design of the web page or application.

There are more than 1,000 commercial controls currently provided by third-party software developers. Microsoft activex component gallery stores relevant information and related connections,They point to various activex controls provided by Microsoft and third-party developers. In Microsoft's activex component gallery, you can find a list of companies developing Internet-enhanced activex controls.

20, Question:Why use strstartport=(request.form ("catmenu_0") statement to get the value of the starting site in the form but can't find it in the database?

Answer:This is because there may be spaces in the value of the starting site.For example, the original meaning was "Hangzhou", but due to the existence of spaces,The value obtained by the asp program may be "Hangzhou", and there are only records of "Hangzhou" in the database.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:When the life cycle of a variable ends in asp,There are several ways to preserve the contents of a variable?A:Any action that ends the page,For example, when the browser's "Refresh" button is pressed, or the browser is closed,Reopen it again,Will lead to the end of the variable life cycle.

If i want to end the execution of the page,It is also possible to preserve the contents of variables,In preparation for the next execution,This can be achieved with the help of an application object.For example, you can use the application object to make a counter that counts website traffic.

The session object is the same as the application object.The content of the variable can be stored at the end of the page,But 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 their own session object.

Application objects and session objects can help us record information on the server side,The cookies object uses the cookie function provided by the browser to record information on the client.One thing to note,Cookies are information recorded in the browser,So data access is not as simple as accessing other asp objects (information is stored on the server side),In terms of actual operation,Only when the browser starts to browse a certain page of the server,Before the server has downloaded any data to the browser,The browser can exchange cookie data with the server.

22. Question:What should the subject do after using it?A:When you are finished 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 less efficiently or even crash because of too many objects.The corresponding statement is as follows:

set object=nothing
  • Previous Workaround for unable to start NET Framework NGEN v4030319_X86 service
  • Next Data operation case analysis in ThinkPHP