ASP 3.0 Advanced Programming (36)

Source: Internet
Author: User
Tags object definition interface connect odbc sql ole access
Programming | Advanced 8th Chapter ADO Basics
In the first 7 chapters of this book, we've covered the ASP and how the ASP brings dynamic content to the Web site. It has been seen that its scripting programs allow you to customize Web pages, enabling us to build more powerful ASP pages.
Now, the integration of ASP and data will be studied. There is no limit to the number of scripts used in Web pages, but without some form of data, a dead end will soon be reached. Data makes up the actual content of the Web site, or it indicates how to set up a Web site, so the overall data is very important. If you build a Web site around your data store, you can change your Web site with only the appropriate data.
ActiveX Data Objects (ADO) are components that allow users to interact with the data store. This means that a Web page, or a fully interactive e-business system, can be built as long as it is based on some data. Either way, ADO allows us to communicate with the data. We will discuss the main content of data acquisition and transfer from the data store, and the data processing methods after the data is obtained.
Start by studying what ADO is and what components it includes, and then discuss how to access the data store. In the next chapter, you will learn more about some of the more advanced features of ADO, such as commands, stored procedures, and some operational tips for optimizing applications. The next step is to study the interaction between Web servers and browsers, as well as the process of data processing. Then it studies the potential XML in the field of data access. What is XML? How to use it? Because XML represents a trend for future development, we will introduce Microsoft's vision for universal data access. In this idea, data is not just obtained from the database. Finally, look at the standard Microsoft database (such as access and SQL Server) and how to use ADO in it.
This chapter starts from ADO, the main contents are:
· Study how ADO interacts with data.
· Learn about the components of ADO.
· How to connect to and create a dataset with the data store.
· How data is processed and modified.
· How to handle ADO errors.

Definition of 8.1 ado
ADO is a fairly simple idea, a thought that allows you to access data in just one way. ADO is not a new idea, only the use of existing database access technology, and its integration to form a new thing to adapt to the needs of the present and future. Adapting to the needs of the future is a very important thing. Many other technologies, such as DAO and ODBC, are acceptable in the development of some applications, but there are some problems with the rise of the Internet.
In many cases, traditional data access methods seem to solve problems with two-tier client/server systems, but require a permanent connection to the data and provide powerful features such as quick response queries, easy data modifications, and more. In the area of the Internet, it is now important to take into account the web's stateless nature and the potentially numerous users who can access the Web site. It is not realistic to establish a permanent connection to data, so you must consider these factors when designing your application.
So what does old DB and ADO exactly say? Let's answer this question by comparing some of the existing data access technologies. If readers have ever contacted database programming, they may be familiar with ODBC and RDO. Open Database Connectivity (ODBC) is an application programming interface (API) that allows access to relational databases, such as Access and SQL Server. Because it is an API, many programmers, especially in the Visual Basic field, find it very complex to use. A remote Data Object (RDO) is an ActiveX object located on the upper level of ODBC that provides all the features of ODBC and is simpler to use.
OLE DB can be equated to odbc,ado equivalent to RDO.
OLE DB is a basic technology for applications to interact with data sources.
This is quite complex, and it is true that only C and C + + programmers can use it. As the name of ADO implies, it is an ActiveX object that can easily access OLE DB functionality.
You may find that the term ActiveX is often mixed with COM objects. They are not fundamentally different for ASP programmers, since both are based on COM system architecture, except that ActiveX is a cross-platform standard for components, and COM is Windows proprietary.
Although Microsoft has introduced a new technology for accessing data, it does not immediately eliminate the old technology, and ODBC works well and works closely with OLE DB and ADO. In fact, ODBC is not just a Microsoft product, but also controlled by international components. And because of widespread use, ODBC will not suddenly die out. The idea behind OLE DB is not to abandon existing technologies, but to constantly improve them.

8.1.1 OLE DB and ADO architecture
A brief explanation of the main aspects of OLE DB and ADO is given earlier. Figure 8-1 shows how these two technologies relate to applications and data storage:

Figure 8-1 OLE DB, ADO and its relationship to applications and data storage
The whole idea can be seen from figure 8-1. The top of the diagram is the application (Web or general application, which is irrelevant), and the following are the ADO and/or OLE DB that provide access to the data. Both ADO and OLE DB are both because OLE DB is a basic technology. However, OLE DB does not apply to all languages, so ADO is located on the upper level of OLE DB, providing programming interfaces for languages that do not have direct access to OLE DB, such as Visual Basic and scripting languages. ADO provides a much easier programming interface than OLE DB, so even those programming languages that can use OLE DB directly, such as C + + or Java, can use ADO to simplify access to data.
Figure 8-1 shows the Microsoft programming language, and ADO is a COM component, so it can be used in any COM-compliant programming language, such as Delphi or scripting languages that support the Active Scripting interface. So, while ADO is about platform, it has nothing to do with developing languages. Of course, for ASPs using VBScript and JScript primarily, there are some Visual Basic code when using ADO in a component.
Now that OLE DB and ADO are allowed to access data, why do they need them? Does the old method have a problem? Here are two main reasons:
First, OLE DB and ADO are used to access the data store. Note that this refers to "data store" rather than "database". Although the database is still the most widely used form of data storage, it does not necessarily contain all of the data. Some messaging systems, such as Microsoft Exchange Server, are also commonly used to store data. Directory services are starting to show up with data about users, machines, and so on, and there is a lot of information on the Web server. You can continue to list, and obviously you need a way to access all of these different types of data.
Second, it stems from the rise of Internet applications and the nature of the web's state. The way in which data was accessed in the past is primarily about processing data with a permanent connection to the data store. OLE DB and ADO are designed to solve this problem and provide disconnected recordsets, which we'll see later.

8.1.2 Consumers and providers
The ADO system structure diagram shows how ADO works between applications and real data stores. In Microsoft's literature, there are two understandable terms: consumers (Consumer) and providers (Provider), but figuring out their exact definition is critical.
The provider is the object that provides the data, and the consumer is the object that uses (consumes) the data.
In programming, applications are often found to be consumers of data. But what about the provider? Typically data storage, and because OLE DB is designed to be used to talk to different data stores, there is an OLE DB provider for each unique type of data store.
The idea of this individual provider is not new, but it makes programming easier. Write programs with ADO or OLE DB conversations, and OLE DB to talk to providers again. This means learning a set of methods to access data, regardless of how the data is stored, and in some cases you can actually change the provider without changing any code at all. This is where ADO and OLE DB are really superior, providing a common set of programming interfaces for data storage.
To connect to the data store, you must use the OLE DB provider. The initial settings provided to ADO 2.5 are:
· Jet OLE DB 4.0: For Microsoft Access databases.
· DTS Packages: Data Transformation Services for SQL Server (Database transformation service).
· Internet Publishing: Used to access Web servers.
· Indexing Services: For indexing directory (index catalogs).
· Site Server Search: For sites server lookup directories.
· ODBC Drivers: For ODBC data sources.
· OLAP Services: For Microsoft OLAP servers.
· Oracle: for Oracle databases.
· SQL Server: For Microsoft SQL Server database.
· Simple Provider: for easy text files.
· MSDataShape: For hierarchical data.
· Microsoft Directory Services: A directory service for Windows 2000.
· DTS Flat Files: Flat file management for Data Transformation Services for SQL Server.
This is only the initial list provided by Microsoft and depends on the services and software installed on the server. The Oracle data provider, for example, requires Oracle client software to be installed on the client computer.
OLE DB providers can be obtained from other manufacturers for other data stores. You can even write

[1] [2] Next page



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.