Chapter 24: Working with Data Binding and DataSets


Chapter 24

Working with Data Binding and DataSets

After completing this chapter, you will be able to:

  • Bind a property of a control to a data source at design time or run time by using simple binding.

  • Bind a control to a list of values from a data source by using complex binding.

  • Design a DataSet class containing TableAdapter and DataTable classes.

  • Write code to instantiate and populate a DataSet object.

  • Use a DataGridView to modify the data held in a DataSet object.

  • Validate the changes the user has made to the data in a DataGridView control

  • Update a database with the changes made to a DataSet object using a TableAdapter object.

In Chapter 23, “Using a Database,” you learned the essentials of using Microsoft ADO.NET for executing queries and updating databases. You used a DataSet to retrieve data from the Suppliers and Products tables and display it in a master/details form. You achieved this simply by using the Data Source Configuration Wizard, configuring DataTable classes, and dragging and dropping DataTable classes onto a form to generate DataSet, BindingSource, TableAdapter, and BindingNavigator controls. You actually wrote very little code to do all of this. In this chapter, you will write C# statements that perform many of these tasks—this will help you to understand what Microsoft Visual Studio 2005 is doing for you, and enable you to write more complex applications that can achieve more functionality than can be generated by using drag and drop techniques alone.

In this chapter, you'll learn more about data binding—linking a control property to a data source. You will learn how to dynamically bind properties of controls to a DataSet by using simple data binding. You will also learn how to use complex data binding with the ComboBox and ListBox controls. You will learn a lot more about how to design DataSet classes and use DataSet objects in code. In particular, you will learn how to use DataSet objects with the DataGridView control to update a database in an efficient manner.




Microsoft Visual C# 2005 Step by Step
Microsoft® Visual C#® 2005 Step by Step (Step By Step (Microsoft))
ISBN: B002CKYPPM
EAN: N/A
Year: 2005
Pages: 183
Authors: John Sharp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net