Chapter 28

DataSets and DataBinding


  • Creating DataSets
  • Connecting visual controls to a DataSet with DataBinding
  • How BindingSource and BindingNavigator controls work together
  • Chaining BindingSources and using the DataGridView
  • Using Service and Object data sources

A large proportion of applications use some form of data storage. This might be in the form of serialized objects or XML data, but for long-term storage that supports concurrent access by a large number of users, most applications use a database. The .NET Framework includes strong support for working with databases and other data sources. This chapter examines how to use DataSets to build applications that work with data from a database.

In the second part of this chapter, you see how to use DataBinding to connect visual controls to the data they display. You see how they interact and how you can use the designers to control how data displays.

The examples in this chapter are based on the sample AdventureWorksLT2008R2 database available as a download from


The .NET Framework DataSet is a complex object approximately equivalent to an in-memory representation of a database. It contains DataTables that correlate to database tables. These in turn contain a series of DataColumns that define the composition of each DataRow. The DataRow correlates to a row in a database table. You can also establish relationships between DataTables within the DataSet ...

Get Professional Visual Studio 2012 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.