Common ASP ActiveX components

Source: Internet
Author: User
Tags dsn functions connect odbc web database microsoft iis
Active|activex Author: scholar

When you use ASP to write server-side applications, you must rely on ActiveX
Component to powerful Web
The functions of the application, such as: you need to connect the database, the database online operation, etc., following the introduction
After the AD Rotator component, this article will go on to introduce some other common ASP ActiveX
How the component is used.


There have been a lot of letters from friends recently asking me if ASP can only be in Microsoft IIS
Can be run on the non-NT
Operating on the platform? I have answered this question many times:
I've just heard of some kind of software that I can support, but I've never seen it. But some enthusiastic friends still tirelessly letter inquiries, so in the hospitality of their friends, I visited the
ASP related sites, unexpectedly surprised to find that the original ASP is really can run in other non-NT
platform, so at the beginning of this article, I would like to give a brief account of the friends who wrote
ASP is used on NT platforms.


To develop and run ASP on a non-NT platform
Applications we can rely on a set of named Instant ASP
The third party software, its advertising slogan is very attractive "ASP anytime, Anywhere", I think all
ASP's developers are bound to be thrilled to see such slogans. This set by Halcyon
Software companies develop software that makes it unnecessary for you to repeat the development of the original ASP
The application can run it on any operating platform!
This saves a lot of development time, and makes ASP
Truly becomes a cross-platform Internet, Intranet, or Extranet application.
Instant ASP itself is actually a set of Java based
Application, so you can use the WEB based ASP
The application runs on any platform, and the following table lists the Instant ASP
The operating platform supported by the current version.





Even more surprising is that Instant ASP not only provides ASP
Operating environment, and it is more than the current ASP on the market
The application also provides a more powerful and practical feature that will ActiveX components and Enterprise
Java Beans or Corba-compliant objects together to make ASP
has a wider range of applications. It also provides a way to pass ADO
Interface access to a variety of databases, and generate dynamic pages of powerful features. For developers, you can use a programming language or tool that you are good at
: Visual Basic, Jscript, VBScript, C + +, Java, HTML, Delphi, MS Visual InterDev
And so on to develop. About Instant ASP
Specific installation and operation I'm not here to start, interested friends can go to its site to see
Halcyonsoft.com, you can also download a trial version for free.



In the last article, the author introduced the AD rotator
After using the component, today we'll take a look at some other ASP-common components.



One, Database Access components



We use the Web on a Web server
The most common and practical task of an application is to access the server-side database. and
The ASP built-in Database Access component enables us to easily pass ActiveX Data
Objects (ADO)
Access information stored in a server-side database or other tabular data structure. Ado
is the most efficient and straightforward way to operate the database currently supported by Microsoft, a powerful data access programming model that allows most data source programmable properties to be extended directly to your
Active Server page. You can use ADO to write compact and concise scripts to connect to
Open Database Connectivity (ODBC)-compatible databases and OLE DB-compliant data sources, so
ASP programmers can access any ODBC-compliant database, including MS SQL SERVER, Access, Oracle
Wait a minute. If you are a scripting person with a certain understanding of database connections, you will find
Ado
Command statements are not complex and easy to master. Similarly, if you are an experienced database programmer, you will correctly understand
ADO's advanced language-independent and query-processing functions. Familiar with VB
Database programming friends will find ADO and RDO (Remote Data Objects)
There's some kind of place like that. But ADO is said to be accessing faster and less memory.



Here's a brief introduction to using ASP's Database Access component via ADO
To connect to and manipulate a WEB database



The first step: Specify the database you want to connect to, with DSN and dsn-less
Two methods.



DSN (data source name datatype):
Establish a system data source name as follows:



1, click "Start", select the Settings Control Panel.



2, double-click the icon "32-bit ODBC", will pop up a dialog box, select the label "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" column, and click "Select" to select the database storage location, which you can select by clicking "Browse".




5, after the completion of the above steps in the ASP program to specify DSN, as follows:



<%CONNSTR = "DSN"%>



Dsn-less: Is another way through the ASP
To specify the location of the database file directly in the file without having to create a DSN
The method. Because many companies do not have their own WEB
Servers, their sites are often stored on remote virtual servers, so to create and modify
Setting up a DSN is a bit cumbersome. and using dsn-less
Method directly specifies the location of the remote database to solve the problem, as follows



:


<%

ConnStr =
"Dbq=" +server.mappath ("Database/source.mdb") + ";D efaultdir=;D River={microsoft
Access Driver (*.mdb)};D riverid=25;fil=ms
Access;implicitcommitsync=yes; maxbuffersize=512; maxscanrows=8; pagetimeout=5; safetransactions=0; threads=3; Usercommitsync=yes; "

%>





  
After you specify the database that you want to connect to, you can connect and open the database in the following ways
:



<%

Set Conn = Server.CreateObject ("ADODB. Connection ") Conn.Open Constr

%>





Step Two: Specify the SQL instructions you want to execute, and you can use the RecordSet.



When you connect to a database, you can manipulate the database, such as queries, deletes, updates, and so on, which are done through
SQL instructions, the following example queries the database table datebase for records with "a" in all names
:



<%

Sql= "SELECT * from datebase where name like ' a%% '"

Set rs = conn.execute (SQL)

%>



Although the Connection object simplifies the connection database and query tasks, the Connection
There are still many deficiencies in the object. To be exact, the Connection for retrieving and displaying database information
Objects cannot be used to create scripts, you must know exactly what changes you want to make to the database before you can use the query to implement the changes. For retrieving data, checking results, changing databases,
ADO provides a Recordset object. As its name implies, the Recordset
Objects have many features that you can use that, depending on your query restrictions, retrieve and display a set of database rows, that is, records.
Recordset
Object keeps the location of the records returned by the query, allowing you to scan the results one at a time. Under



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.