Chapter 30. Core ADO.NET

WHAT'S IN THIS CHAPTER?

  • Connecting to the database

  • Executing commands

  • Calling stored procedures

  • The ADO.NET object model

  • Using XML and XML schemas

This chapter discusses how to access data from your C# programs using ADO.NET. It shows you how to use the SqlConnection and OleDbConnection classes to connect to and disconnect from the database. You learn the various command object options and see how commands can be used for each of the options presented by the Sql and OleDB classes, how to call stored procedures with command objects, and how the results of those stored procedures can be integrated into the data cached on the client. The ADO.NET object model is significantly different from the objects available with ADO. The DataSet, DataTable, DataRow, and DataColumn classes are discussed as well as the relationships between tables and constraints that are part of DataSet. The class hierarchy has changed significantly since the release of the .NET Framework 2.0, and some of these changes are also described. Finally, you examine the XML framework on which ADO.NET is built.

The chapter begins with a brief tour of ADO.NET.

ADO.NET OVERVIEW

ADO.NET is more than just a thin veneer over some existing API. The similarity to ADO is fairly minimal — the classes and methods of accessing data are quite a bit different.

ADO (ActiveX Data Objects) is a library of COM components that has had many incarnations over the past few years. ADO consists primarily of the Connection, Command, ...

Get Professional C# 4 and .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.