Professional C# 2005
by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones
Chapter 19. Data Access with .NET
This chapter discusses how to get at data from your C# programs using ADO.NET and covers the following details:
Connecting to the database—You learn how to use the
SqlConnectionandOleDbConnectionclasses to connect to and disconnect from the database.Executing commands—ADO.NET has command objects, which can execute SQL commands or issue a stored procedure with return values. You learn the various command object options and see how commands can be used for each of the options presented by the
SqlandOleDBclasses.Stored procedures—You learn 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—This is significantly different from the objects available with ADO, and the
DataSet, DataTable, DataRow, andDataColumnclasses are discussed as well as the relationships between tables and constraints that are part ofDataSet. The class hierarchy has changed significantly with version 2 of the .NET framework, and some of these changes are also described.Using XML and XML schemas—You examine the XML framework on which ADO.NET is built.
As is the case with the other chapters, you can download the code for the examples used in this chapter from the Wrox Web site at www.wrox.com. 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access