Talking about Ado.net and ado!!

Source: Internet
Author: User
Tags include modify ole one table require table name firewall
ADO recently always see a netizen asked about ado.net and ADO about the difference and good or bad, think oneself in just contact. NET really have this doubt, now will my little understanding and experience to write, I hope to help you a bit! In fact, most of it comes from msdn!!. ADO for applications written in native code, ADO provides a COM based application-level interface for OLE DB data providers. Like Ado.net, ADO supports a variety of development needs, including creating front-end database clients and middle-tier business objects using live connections to data in relational databases and other storage areas. And, like ADO. NET, ADO can build a set of client recordsets, a loosely coupled Recordset, and a data-shaping rowset that handles OLE DB.
ADO also supports some not through ADO. NET exposed behavior, such as a scrollable server-side cursor. However, because server-side cursors require database resources to be saved, using them can have a significant negative impact on the performance and scalability of your application. In order to transmit an ADO recordset through a firewall, you need to configure the firewall to enable the COM marshaling request and consider the associated security consequences. COM marshaling also restricts the data type to those data types that are defined by COM standards. You can choose to keep the ADO recordset in XML format and transfer the XML text. Ado.net is an important application-level interface for providing data access services in the Microsoft. NET platform. In ADO. NET, you can use the new. NET Framework data provider to access the data source. These data providers include:
SQL Server. NET Framework data Provider. An OLE DB. NET Framework data Provider. An ODBC. NET Framework data Provider. Oracle. NET Framework data Provider. These data providers can meet a variety of development requirements, including middle-tier business objects that use active connections to relational databases and data in other stores.
Ado.net is designed for messaging-based Web applications and provides better functionality for other application architectures. By supporting loosely coupled access to data, ado.net reduces the number of active connections to the database (that is, reducing the likelihood of multiple users competing with limited resources on the database server), enabling maximum data sharing.
Ado.net provides several methods of data access. In some cases, a WEB application or XML Web service needs to access data from multiple sources, or it needs to interoperate with other applications, including local and remote applications, or it can benefit from maintaining and transferring cached results, which makes it a wise choice to use a dataset. As an alternative, Ado.net provides data commands and data readers to communicate directly with the data source. Database operations that are performed directly using data commands and data readers include running queries and stored procedures, creating database objects, and using DDL commands to update and delete directly.
Ado.net also enables maximum data sharing by supporting xml-based persistence and transport formats for the basic object dataset of distributed ado.net applications. A dataset is a relational data structure that can be read, written, or serialized using XML. ado.net datasets make it easy to build applications that require loosely coupled data exchange between the application layer and multiple Web sites.
Because datasets are processed remotely as XML, any two components can share data and use an XML schema to define the relational structure of the dataset. Also, because the serialization format of the dataset is XML, the DataSet object can easily traverse the firewall without any restrictions. In addition to loading data from XML, datasets are populated with data from SQL Server and data sources exposed through OLE db, and can save changes to those data.
One of the main features of a dataset is that you can access and manipulate data in a local dataset in two ways:
----a DataSet as a table in a relational database can contain a collection of tables or tables. An important feature of a dataset is that it tracks the relationships between the tables it contains, as if it were a relational data store in memory. As XML (Extensible Markup Language) structure----data in a dataset can also be accessed in the form of XML data. Provides the means to read and write data in XML, and to read and write the structure of the dataset as an XML schema. In addition, to allow synchronous viewing, querying, and modifying data in XML form, you can associate XmlDataDocument with a dataset. Select Ado.net or ADO
Ado.net and ADO all have the following characteristics: Easy to program, language-independent, simple to implement, minimal network traffic, and very few layers between application front-end and data sources. Both of these methods provide high performance data access.
Whichever of these two data access technologies you choose will affect your application's design, scalability, interoperability, ease of maintenance, and many others. These areas include:
Managed code if your application is written in managed code and built based on the common language runtime, you should use Ado.net. If you are writing unmanaged code in C + + (especially when maintaining an existing ADO application), ADO is still a good choice. A data structure Ado.net dataset can contain one or more tables, and provides both a table-based relational view and an xml-based view. Datasets use standard common language runtime types, which simplifies the programming process. An ADO recordset is a single table that can only be accessed as a recordset and does not contain relationships. An ADO recordset can be the result of a multiple-table JOIN query, but it is still just a single result table. If you want ADO to have more than one table, you must have multiple Recordset objects. Due to its integrated relational structure, ado.net datasets provide better functionality.
Data sharing ado.net provides the basis for data exchange between components and across tiers: Datasets can be passed on inte-rnet in XML and can be passed through firewalls. You can view a dataset as a relational table within your application, while in some other applications you view the same dataset as an XML data structure. Datasets provide convenient bidirectional conversions: from dataset tables to XML documents, and from XML documents to dataset tables. If you use COM marshaling to transmit an ADO recordset, the target application must be written to use the recordset data structure. Compared to reading only XML data, it requires much more difficulty in programming. Alternatively, you can keep the ADO recordset as XML, which makes it easier to share data with other applications and services.
Scalable Ado.net is the most scalable solution. Ado. NET was designed as a data access structure from the outset to generate the best data access structure for scalable Web applications with a lower total cost of ownership. If you do not need scalability and are not written in managed code, you can continue to use ADO. The cursor position application can establish a result set in either of the following two locations: within an application process (client cursor) or in a data store process (server-side cursors). Client-side cursors are usually a good choice for any type of user-impromptu interaction with the data. Client-side cursors are supported by the DataSet object in Ado.net, and in ADO by the Clientcursor Recordset object. Sequential, read-only server cursors are supported by a data reader (such as a SqlDataReader or OleDbDataReader object) in Ado.net, while in ADO by a read-only/readonly Recordset object. Sequential, read-only cursors provide the quickest way to read data from a database.
Scrollable, updatable server-side cursors are supported in ADO by scrollable, updatable Recordset objects. Server-side cursors should be used with caution. Non-sequential scrolling and update operations on results through server-side cursors remain locked and result in resource contention, which greatly limits the scalability of the application. Without a scrollable, updatable server-side cursor, and the process of processing the results on the server using stored procedures, the application usually benefits.
Both data access connections Ado.net and ADO support explicit connections to the database. In ADO. NET, developers can use a data reader, keeping the lock based on the current location, and requiring continuous connections to the database before reading the data. Alternatively, the data can be placed in a dataset. When working with datasets, developers can make the following choices: Keep connections and transactions open while modifying data in a dataset, or open connections and use transactions only when you need to populate data sets and update changes back to the database. When you are transferring, viewing, and modifying data in a dataset, closing the connection frees resources and locks for other users. In ADO, a recordset can use an open connection and remain locked while the user is reading through the data in the database, or use a client cursor recordset to process the data without retaining the database connection. Data scrolling ado.net and ADO can either browse the data sequentially or browse the data in a sequential order. Use ADO. NET DataSet, you can also easily navigate from one row of a datasheet to a related row in another table. Both the ADO recordset and the Ado.net data reader support high-speed, forward-only, read-only server-side cursors. An ADO recordset uniquely supports scrollable, updatable server-side cursors, although such cursors use server resources and, in most cases, are better implemented in the form of logic in stored procedures, or as loosely coupled client cursors. Use simple ADO. NET DataSet provides self-describing data and eliminates the need to work with underlying data constructs such as tables, columns, constraints, and rows. Instead, using datasets, you can use objects for type-safe access to data. This makes the program easier to read, write, and modify. Because the application layer can exchange data through an XML-formatted dataset, new extended communications can be easily implemented during the lifecycle of an application. Use ADO. NET, it does not matter which language is used for data access: they are syntactically similar and use the same common language runtime service. Although both Ado.net and ADO support loosely coupled data access, there are differences. With Ado.net, you can control how data set changes are transferred to the database by modifying the statements used by the DataAdapter object or by inserting custom code that responds to row update events. Use this feature to optimize performance, modify validation checks, or add any additional processing, all without having to change your application. For more information, see problems in the. NET application Architecture. A comparison of ADO and Ado.net----------------------------------------------------------project ADO ado.net —————————————————————————————————————————————————————————— data Update directly processes similar batch data access faster (because in-memory) the access to data records recordset Dataset.tables (" Data table name ") Data search Recordset.find dataset.tables (" datasheet name "). Select data Traverse recordset.movenext mydataset.tables (" datasheet name "). Rows (i+=1) a field recordset.fields ("field name") mydataset.tables ("Datasheet name"). Rows (x,y) versatility is more difficult to pass between hosts, which can be transferred to XML across the network (over firewalls) data expression is more complete (view and table only) (can include multiple data tables, and its associated) system resources are more wasteful (must always be connected)


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.