ASP: Common ASP ActiveX Components

xiaoxiao2021-03-06  50

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 treasure </ Title> </ head> <body> <p> Network electronic reading navigation <% set link = server.createObject ("mswc.nextlink") count = link.getlistcount ("nextLink.txt") DIM IFOR i = 1 to count %> <ul> <li> <a href = "<% = link.getnthurl (" nextLink.txt ", i)%>> <% = link.getnthdescription (" nextLink.txt ", i)%> < / a> <% next%> </ body> </ html> In the above code, let's use the getListCount method to determine how many items in the file nextLink.txt, then use the cyclic statement, and use getnthurl, getnthdescription method one by one The content stored in the nextLink.txt file is read and displayed to the client browser. The number of items in the Content Linking component all available methods of use GetListCount (File). GetNextURL (file) Gets the URL of the next page listed in the Content Link list file. GetPREVIOSDESCRIPTION (File) Gets the description line of the previous page listed in the content link list file. GetListIndex (file) Gets the index of the current page in the content link list file.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-109931.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="109931" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.041</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '8B_2BvIEybIoz8JF3oaAVDJMdYlte9_2BiNoL_2F9ruJVpIBZvok_2FfG8vKq37plM4JaaDjL_2FIu_2BA1Y5wjljGdmxBr_2Bnw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>