ASP: Common ASP ActiveX Components When you write a server-side application with ASP, you must rely on the ability of the ActiveX component to power the web application, such as: you need to connect the database, operate online operation, etc. This article will then introduce you to the usage of other common ASP ActiveX components in this over the Ad Rotator component. There are still many friends in recent recently to ask me, whether the ASP can only run on Microsoft IIS, can you operate on a non-NT platform? I have already answered many times this question: I just heard that some kind of software that can support, but never seen it. But some enthusiastic friends still have a tireless to ask, so I am visiting the ASP-related sites under the prevalence of friends, and the ASP is indeed on other non-NT platforms, so in this The beginning of the article, I briefly introduced the friends of the letter to how to use ASP on a non-NT platform. To develop and run the ASP application on a non-NT platform, we can rely on a third-party software called Instant ASP. Its advertising slogan is very attractive "ASP Anytime, Anywhere", I think all ASP developers look So whisper is inexpensive. This set of software developed by Halcyon Software allows you to run it on any action platform without repeated development of the original ASP application! This is not a large number of development time, and the ASP has truly become a cross-platform Internet, Intranet, or Extranet application. Instant ASP itself is actually a Java-based application, so you can run web-based ASP applications on any platform, the following table lists the operating platforms supported by Instant ASP. What is more surprising is that INSTANT ASP not only provides ASP's operating environment, but it is more powerful and practical than the current ASP app on the current market. It combines ActiveX components and Enterprise Java Beans or CORBA-Compliant Objects. Get up, so that the ASP has a broader application. It also provides a powerful feature that connects to various databases through the ADO interface and generating dynamic pages. For developers, you can use your programming language or tools such as: Visual Basic, JScript, VBScript, C , Java, HTML, Delphi, MS Visual InterDev, etc. Regarding the specific installation and operation of Instant ASP, I will not be unfold here. Interested friends can go to its site to see HalcyonSoft.com, you can also download a trial version for free. Following the authors introduced you to the use of the AD Rotator component, we will then look at some other ASP common components. 1. The most common and most practical tasks that the Database Access component we use the web application to use the web application is to access the server's database. The ASP built-in Database Access component allows us to easily access information stored in a server-side database or other formalized data structure through ActiveX Data Objects (ADO). ADO is the most effective and simple and straightforward method for operating the database supported by Microsoft. It is a powerful data access programming mode that makes most data source programmable properties to be extended to your ACTIVE. On the Server page.
You can use ADO to write compact scripts to connect to Open Database Connectivity (ODBC) compatible databases and OLE DB-compatible data sources, so ASP programmers can access any database compatible with ODBC, including MS SQL Server, Access, Oracle, etc. If you are a script writing personnel with a certain understanding of the database connection, you will find that the ADO command statement is not complicated and easy to master. Similarly, if you are an experienced database programmer, you will correctly understand the advanced language-independent and query processing features of ADO. Friends who are familiar with VB database programming will find that ADO and RDO (Remote Data Objects) have some similar place. But it is said that ADO's access is faster, and memory needs to be smaller. Let's briefly introduce you to the step of connecting the ASP's Database Access component through the ADO and manipulate the web database: Specify the database you want to connect, there are two methods of DSN and DSN-LESS. DSN (Data Source Name Data Source Name): Create a system data source name, as follows: 1. Click Start, select the Control Panel. 2, double-click the icon "32-bit ODBC", will pop up a dialog, select "System DSN" 3, click "Add" to add a DSN entry, select "Microsoft Access Drive" and confirm. 4. Enter the DSN you want to specify in the "Data Source Name" field, then click "Select" to select the data inventory location, you can press "Browse" to select. 5. After the above step is completed, the DSN is specified in the ASP program, as follows: <% connStr = "DSN"%> DSN-LESS: Yes another way to specify the database file directly in the ASP file without establishing a DSN . Since many companies do not have their own web servers, their website is often stored on the far-end virtual server, so it is more troublesome to establish and modify the settings of the DSN. The DSN-LESS method directly specifies that the remote database is in place, and the method is as follows: <% connStr = "dbq =" server.mappath ("Database / source.mdb") "; defaultdir =; DRIVER = {Microsoft Access Driver (* .mdb)}; DriverId = 25; FIL = MS Access; ImplicitCommitSync = Yes; MaxBufferSize = 512; MaxScanRows = 8; PageTimeout = 5; SafeTransactions = 0; Threads = 3; UserCommitSync = Yes; "%> After specifying the database you want to connect, you can connect and open the database: <% set conn = server.createObject (" adodb.connection ") conn.open constr%> Step 2: Specify The SQL instruction to be executed can use the Recordset.
When you connect the database, you can operate the database, such as query, deletion, update, etc., these operations are done by SQL instructions, as follows, in the database table DateBase, query all names "A" records: <% sql = "SELECT * from dateBase where name Like 'a %%'" SET RS = Conn.execute (SQL)%> Although the Connection object simplifies the connection database and query tasks, there is still a lot of shortcomings. Specifically, the Connection object that retrieves and displays database information cannot be used to create scripts, and you must know the changes you want to make for the database before you can use the query to make changes. For retrieval data, check results, change the database, ADO provides the Recordset object. As its name, the RecordSet object has many features you can use, retrieved and display a set of database lines according to your query restriction, and display a set of database lines. The Recordset object holds the location of the record returned by the query, allowing you to step by step by step. You can scroll and update records according to the pointer type property settings of the Recordset object. The database pointer allows you to locate a specific item in a set of records. The pointer is also used to retrieve and check the record, slow dragonfly? BR> records on the basis of the record. Recordset objects have some properties that can be used to accurately control the behavior of pointers, enhance your ability to check and update results. The use of Recordset is as follows: set = server.createObject ("adoDb.recordset") RS.Open SQL instruction, conn, 1, 1 'read or RS.Open SQL instruction, CONN, 1, 3' new, modified , Or delete the third step: use the RecordSet property and method, and display the result of the execution. With the above instruction, we created a cursor "RS" containing the data, and the trigger is a similar record and field of the similar records and fields stored in the active memory. When you create a cursor via the RecordSet component, it is from the data The provider gets a data set, and uses it to enrich the cursor, we can imagine the recordset generated by ADO is a record of the spreadsheet, it has a line of records, there is a line of it is its current row, and Recordset The field is represented by the Field collection of Recordset. Some properties and methods of the created Recordset object (cursor) are listed below: rs.fields.count: The total number of fields of Recordset objects. RS (i) .name: The name of the i-th field, i is calculated from 0 to rs.fields.count-1. RS (i): Read the data of the i-th field, i is calculated from 0 to rs .fields.count-1. RS ("Field Name": Read the data of the specified field. Rs.Recordcount: The total number of data records in the cursor. Rs.eof: Whether it is pointed to the last record. Rs.Movenext: Move the indicator to the next record. Rs.MovePrev: Move the indicator to the previous record. Rs.MoveFirst: Move the indicator to the first record. Rs.MoveLast: Move the indicator to the last record. Rs.close: Turn off the Recordset object About other introductions of ADO, the author will give you a detailed explanation in the future.
Second, Content Linking Components If your site has a series of interrelated pages, the Content Linking component will be very suitable for your needs, it doesn't make you create a directory table in these pages, and you can establish a dynamic connection between them. And automatically generate and update the directory table and the previous and subsequent web page navigation links. This is a very ideal choice for listing online newspapers, electronic reading websites, and forum mail. Content Linking Components Create a NEXTLINK object for the URL list. To use the Content Linking component, you must need to create the Content Linking List file first. The Content Linking component is using this file to get information about all pages that we want to link. In fact, the file is a plain text file, its contents are as follows: Page1.htm One Page2.htm Two Page3.htm Three Page4.htm Four Page5.htm Five Page6.htm Six This text file has the following form: URL Description Comment, the URL is the key address associated with the page, which provides text information that can be used by the super chain, and Comment contains annotation information that is not interpreted by the Content Linking component, which is like a comment in the program. Description and Comment parameters are optional. Let's take a look at how to specifically use the Content Linking component:
Network electronic reading navigation <% set link = server.createObject ("mswc.nextlink") count = link.getlistcount ("nextLink.txt") DIM IFOR i = 1 to count %>