Developer .NET UPDATE--ADO.NET 2.0 Objects--March 18, 2005

This Issue Sponsored By
This email newsletter comes to you free and is supported by the following advertisers, who offer products and services that might interest you. Please take a moment to visit these advertisers' Web sites and show your support for Developer .NET UPDATE.

VMware Workstation 4.5

SQL Anywhere Studio from iAnywhere Solutions

Free ASP.NET 2.0 Training CD!

1. Developer .NET Perspectives

  • ADO.NET 2.0 Objects
  • 2. News

  • SQL Server 2005 Roadshow Provides Upgrade Training
  • 3. Events and Resources

  • Win a Harley at SQL Server Magazine Connections
  • Get Ready for SQL Server 2005 Roadshow in a City Near You
  • SQL Server Administration for Oracle DBAs
  • Featured Thread: Is There a Bug in the .NET Framework?
  • 4. Announcements

  • Vote for the 1st MCP Hall of Famer
  • Get SQL Server Magazine and Get Answers
  • 5. New and Improved

  • UI Toolbox for .NET Developers
  • Flowchart T-SQL and Visual Basic .NET Code

  • Sponsor: VMware Workstation 4.5
    Join the Virtual Revolution--try VMware(R) Workstation now, free! With award-winning VMware Workstation 4.5, you can:

    • Run multiple operating systems simultaneously on a single PC
    • Develop, test, and deploy the most complex networked server-class applications running on Microsoft(R) Windows(R), Linux(R) or Novell(R) NetWare(R) all on a single desktop
    • Spend less time configuring and rebooting, more time developing

    VMware Workstation is powerful virtual machine software for developers and system administrators who want to revolutionize software development, testing and deployment in their enterprise. Essential features include: virtual networking, live snapshots, drag and drop, shared folders and PXE support, making VMware Workstation the most powerful and indispensable tool for enterprise IT developers and system administrators. Get your free trial now!

    1. Developer .NET Perspectives

    by Bill Sheldon, [email protected]

    ADO.NET 2.0 Objects
    In "Three Cool New Features in ADO.NET 2.0" (, I talked about some of ADO.NET 2.0's new features. Today, I'll continue to focus on ADO.NET 2.0, but instead of discussing features that are specific to SQL Server 2005, I'll focus on the objects used by ADO.NET 2.0.

    At the top level, the System.Data namespace represents ADO.NET, no matter which version you use. The classes in this namespace apply across all the various data-access methods. For example, the Dataset and DataTable classes are generic across the various implementations of ADO.NET. Regardless of the data source used to retrieve your data, you can rely on the behavior of these objects because they've abstracted the underlying data source. But ADO.NET 1.0 has exceptions to this standard abstraction. One such exception is the SQLDataReader class defined under the System.Data.SQLClient namespace. This forward-only cursor is available only for SQL Server clients under ADO.NET 1.0.

    Before I get to how ADO.NET 2.0 helps to better abstract the various classes defined in some of the access method namespaces, I want to discuss a new class named DataTableReader. This new object is defined in the System.Data namespace, which means that it's available for any of the database providers supported under ADO.NET 2.0. This object is an excellent addition to the list of available classes; however, I want to warn you not to jump to conclusions based on this new object's name.

    The conclusion you might jump to is that, like the DataTable object, the DataTableReader object represents a single table of data. It doesn't. The DataTableReader is actually used to carry out read-only forward-only operations on one or more tables. Thus, if you want to cycle through an entire data set, you can use DataTableReader to cycle through all the tables in that data set.

    Unlike SqlDataReader, which uses a server-side cursor to cycle through a table of data and retrieve rows, DataTableReader uses a cached copy of the data table being traversed. Thus, there are several differences from this generic reader and SQLDataReader. The main difference is that the constructor for DataTableReader requires either a DataTable or DataSet object as a parameter. In many ways, the best way to think of DataTableReader is as an extension of the DataTable object. The reader version of this object is simply providing a way for you to efficiently emulate the same forward-only behavior you would expect from a reader.

    A change bigger than DataTableReader is coming in ADO.NET 2.0's class hierarchy. In ADO.NET 1.0, the System.Data.Common namespace comes with a generic version of the DataAdapter object, which you can use to populate the DataTable and DataReader objects. Using these three objects, you can work toward abstracting your data source from your application. However, ADO.NET 1.0 doesn't support other database classes such as Command and Connection the same way. Thus, your application can often wind up bound to a specific data source. When you then need to migrate, say, from Oracle to SQL Server 2005, you must make code changes to account for the new data provider. The need to write business-logic code that references a specific type of connection limits the application's ability to move between different databases.

    ADO.NET 2.0 changes this. In ADO.NET 2.0, the System.Data.Common namespace has been extended to contain generic Connection, Command, and related objects. With these new base classes, you can use a generic Command object in your business logic; the only code that will need to be aware of which data-access provider is being used is the code that reads the configuration to create that command or connection. The new base objects provide a layer of abstraction from the various data sources. Thus, you can change the underlying data source without impacting your application code.

    To implement the new base classes in ADO.NET 2.0, Microsoft completely changed the inheritance model used by the data-provider classes. Instead of having most of the data-provider classes inherit from System.Components, they now inherit from a set of classes in the System.Data.Common namespace.

    Thus, instead of writing ADO.NET code that references an instance of a SqlConnection object, you should instead create a SqlConnection object, then pass that object to your business logic as a DbConnection object. That way, the application-specific code becomes unaware of the type of data connection it's using. You still gain all the benefits of using the SQL Server-specific provider, but the data-source specifics are handled behind the scenes.

    For more information about the System.Data.Common classes, I recommend that you check out the Web page for the System.Data.Common namespace in Microsoft Developer Network's (MSDN's) Visual Studio 2005 Library. That page is currently at Another source of information is the MSDN article "Generic Coding with the ADO.NET 2.0 Base Classes and Factories" at

    Sponsor: SQL Anywhere Studio from iAnywhere Solutions
    8 million deployed seats. 1,000 application partners. 20,000 developers. 1,000 customers. FREE for developers. We know it sounds too good to be true, but it isn't. With low maintenance requirements, high performance, open tools and technology integration, and a low cost of ownership, SQL Anywhere Studio is trusted by leading application developers worldwide as the database powering their single- and multi-user desktop, client server, remote office and mobile applications. The free Developer Edition has all the features of SQL Anywhere and doesn't expire at any time. Download today at

    2. News

    SQL Server 2005 Roadshow Provides Upgrade Training
    DBAs, developers, and business intelligence (BI) professionals can learn first-hand how to upgrade to SQL Server 2005 in a one-day intensive course coming to seven cities across the U.S. in April and May. The "Get Ready for SQL Server 2005 Roadshow," produced by SQL Server Magazine and the Professional Association for SQL Server (PASS) and sponsored by Microsoft, will include three content tracks. Scalability Experts trainers will lead the administration track, DevelopMentor trainers will lead the development track, and Hitachi Consulting trainers will lead the BI track. The roadshow is coming to Boston on April 19, New York on April 21, Anaheim on April 26, San Francisco on April 28, Chicago on May 12, Houston on May 17, and Dallas on May 19.

    The roadshow will provide an in-depth look at the new SQL Server release from experts who have worked with the technology for months, according to Kathy Blomstrom, editor in chief of SQL Server Magazine. "Whether your main responsibility is administration, application development, or business intelligence, you'll get in-the- trenches instruction about every aspect of the upgrade process," says Blomstrom. "The roadshow will cover best-practices upgrade planning, building Reporting Services applications, new development technologies in SQL Server 2005, and many other topics that will prepare database professionals to hit the ground running when SQL Server 2005 is released."

    The full-day course includes technical presentations by premier sponsors BMC Software, HP, and Imceda, as well as keynote presentations about SQL Server 2005 innovations by Microsoft technical representatives. The day will end with a user group party hosted by PASS that will give roadshow attendees an opportunity to learn about local user group resources. The registration fee for the roadshow is $99, which includes a full day of technical content, breakfast, lunch, the user group party, a one-year subscription to SQL Server Magazine, a one-year membership to PASS, an attendee bag, roadshow T-shirt, and the opportunity to win prizes from various sponsors.

    For more information, including the complete agenda and registration information, visit the following URL:

    3. Events and Resources

    (brought to you by SQL Server Magazine)

    Win a Harley at SQL Server Magazine Connections
    March 20-23, Orlando, FL. Over 45 sessions presented by Microsoft and industry gurus. Registration includes an exclusive day on SQL Server 2005 by the SQL Server product team. Attendees receive the latest SQL Server 2005 and Visual Studio 2005 betas and a chance to win a Harley-Davidson motorcycle. 800-438-6720.

    Get Ready for SQL Server 2005 Roadshow in a City Near You
    Get the facts about migrating to SQL Server 2005. SQL Server experts will present real-world information about administration, development, and business intelligence to help you implement a best-practices migration to SQL Server 2005 and improve your database computing environment. Receive a 1-year membership to PASS and 1-year subscription to SQL Server Magazine. Register now!

    SQL Server Administration for Oracle DBAs
    Learn the key concepts that give Oracle DBAs a firm foundation in mapping Oracle database-management skills, knowledge, and experience to SQL Server database management. This free eBook gives an overview of the differences between Oracle and SQL Server and provides real-world tips and techniques for managing these technologies. Download now!

    Featured Thread: Is There a Bug in the .NET Framework?
    Forum member Itbhikkus is using Microsoft Visual Studio .NET 2003 with Windows .NET Framework 1.1 to write an application to automate a process for server administrators who are required to audit the security event log for specific events. He's been able to write code that can do this for the application and system event logs, but when he modifies the code for the security event log, he gets "Access Denied" errors. What's even stranger is that the code works when he replaces the server value with ".", making it run on the local host. Is there a bug in the .NET Framework that doesn't permit impersonation to read the security log remotely? If you know the answer, go to

    4. Announcements

    (brought to you by SQL Server Magazine)

    Vote for the 1st MCP Hall of Famer
    Help decide who the most valuable member of the MCP community is. Take the time to reward excellence to those that deserve it and to make yourself a part of the first-ever MCP Hall of Fame. Voting only takes a few seconds, so cast your vote now. Click here:

    Get SQL Server Magazine and Get Answers
    Subscribe to SQL Server Magazine today and get the latest "Top SQL Server Tips" handbook (includes over 60 helpful SQL Server tips) and free online access to every article ever published in the magazine-- that's thousands of problem-solving solutions, expert tips, tricks, and the latest insider notes to help you get the most out of SQL Server. Sign up today:

    Hot Spot: Free ASP.NET 2.0 Training CD!
    See why AppDev was voted the best by thousands of developers nationwide...get a FREE ASP.NET 2.0 Training CD-ROM -- a $95 value! Click the link below for your free training CD...

    5. New and Improved

    (by Karen Bemowski, [email protected])

    UI Toolbox for .NET Developers
    DevComponents released DotNetBar Suite 4.7, a toolbox of 10 integrated components that let Visual Studio .NET developers easily create professional UIs. The menus have the look and feel of Microsoft Office 2003/XP/2000, Visual Studio .NET 2005, and Windows XP. Improvements include Office 2003-like task panes that let developers leverage the latest UI styles in their applications, without writing a single line of code. Pricing starts at $189 for a single-user license. A trial version is available. For more information, contact DevComponents at 248-875-9581 or [email protected]

    Flowchart T-SQL and Visual Basic .NET Code
    Aivosto released Visustin 3.0, a flowcharting tool that reverse engineers T-SQL code to diagrams. Improvements include automated flowcharting of an entire system, robust charting of large modules, and generation of Microsoft Visio flow diagrams. Visustin produces flowcharts from complex, unstructured source code in 18 programming languages, including Active Server Pages (ASP), C#, T-SQL, and Visual Basic .NET. A detailed chart shows all the code with comments attached. A bird's eye view shows the core logic, leaving out unnecessary details. Pricing starts at $299 (standard edition) and $449 (professional edition) for a single-user license. A trial version is available. For more information, contact Aivosto at [email protected]

    Contact Us

  • About Developer .NET Perspectives -- [email protected]
  • About technical questions --
  • About product news -- [email protected]
  • About your subscription -- [email protected]
  • About sponsoring an UPDATE -- contact Richard Resnick, [email protected]
  • Developer .NET UPDATE is brought to you by SQL Server Magazine, the only magazine devoted to helping developers and DBAs master new and emerging SQL Server technologies and issues. Subscribe today.

    View the SQL Server Magazine Privacy Policy

    SQL Server Magazine is a division of Penton Media, Inc. 221 East 29th Street, Loveland, CO 80538, Attention: Customer Service Department

    Copyright 2005, Penton Media, Inc. All Rights Reserved.

    Hide comments


    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.