Chapter 16. Debugging ADO.NET

SO WHAT IS SO DIFFERENT ABOUT ADO.NET that we need to devote a whole chapter of this book to it? Well that’s what we were thinking when we started to write this chapter. But as we dug deeper under the hood, we really began to realize the importance of this chapter. It all became very clear to us—and by the end of this chapter, it will be clear to you, too.

Let’s first take a look at the differences between the old ADO and the new ADO.NET features. Table 16.1 presents these differences. This should help you identify some of the changes up front.

Table 16.1. Differences Between ADO and ADO.NET
FeatureOld ADONew ADO.NET
Memory-resident data representation Uses the RecordSet object. Uses the DataSet object, which can contain one or more tables represented by DataTable objects.
Relationships among multiple tables Requires the use of a JOIN query to return data from tables in a RecordSetSupports the DataRelation object to associate rows in one DataTable object with rows in another DataTable object.
Data visitation Scans RecordSet rows sequentially. Uses a navigation paradigm for nonsequential access to rows in a table. Follows relationships to navigate from rows in one table to corresponding rows in another table.
Disconnected access Available through a RecordSet, but supports connected access, represented by the Connection object. You communicate to a database by using the OLE DB providers. Communicates to a database with standardized calls to the DataAdapter object, which communicates to an OLE DB provider, or directly to SQL Server.
Programmability Uses the Connection object to transmit commands to address underlying data structure of a data source. Uses the strongly typed programming characteristic of XML. Data is self-describing because names for code items correspond to the “real-world” problem solved by the code. Underlying data constructs such as tables and rows do not appear, making code easier to read and write.
Sharing of disconnected data between tiers or components Uses COM marshalling to transmit a disconnected record set. This supports only those datatypes defined by the COM standard. Requires type conversions, which demand system resources. Transmits a DataSet as XML. The XML format places no restrictions datatypes and requires no type conversions.
Transmission of data through firewalls Is problematic because firewalls typically are configured to prevent system-level requests such as COM marshalling. Supported because ADO.NET DataSet objects use XML, which can pass through firewalls.
Scalability Database locks and active database connections long durations contend for limited database resources. Disconnected access to database for data without retaining database locks or active database connections for lengthy periods limits contention for limited database resources.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset