Chapter 28. ADO.NET and LINQ over DataSet

The previous chapter introduced LINQ (Language-Integrated Query) and showed how it works with objects. This chapter introduces ADO.NET, which is the traditional way of accessing databases with previous versions of C# and .NET, and then it introduces LINQ over DataSet, which is the version of LINQ that cooperates with ADO.NET.

All examples in this chapter use the SQL Server Northwind example database (except where specifically noted). See the previous chapter for instructions on installing the SQL Server Northwind example database.

In particular, this chapter looks at the following:

  • An overview of ADO.NET and the structure of its main classes.

  • Reading data with a DataReader and with a DataSet.

  • Updating the database, adding records, and deleting records.

  • Working with relationships in ADO.NET.

  • Reading and writing XML documents in ADO.NET.

  • Executing SQL commands directly from ADO.NET.

  • Executing stored procedures from ADO.NET.

  • Querying ADO.NET objects with LINQ over DataSet.

After an overview of ADO.NET, you will learn the concepts behind it. Then you can create some simple projects and start using the ADO.NET classes.

What Is ADO.NET?

ADO.NET is the name for the set of classes you use with C# and the .NET Framework to access data in a relational, table-oriented format. This includes relational databases such as Microsoft SQL Server and Microsoft Access, as well as other databases and even nonrelational data sources. ADO.NET is integrated into the .NET Framework ...

Get Beginning Microsoft® Visual C#® 2008 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.