Chapter 32Core 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

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/go/procsharp on the Download Code tab. The code for this chapter is divided into the following major examples:

  • ExecutingCommands
  • StoredProcs
  • DataReader
  • IndexerTesting
  • AsyncDataReaders
  • SimpleDataset
  • ManufacturedDataset
  • DataAdapter
  • DataAdapterUpdate
  • Auditing

ADO.NET OVERVIEW

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. This chapter covers the DataSet, DataTable, DataRow, and DataColumn classes 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 ...

Get Professional C# 5.0 and .NET 4.5.1 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.