Beginning Visual C++ 2005 (2006) [eng]-2
.pdf22
Accessing Data Sources in a
Windows Forms Application
In this chapter, you’ll investigate how you can develop form-based applications that will display data from a variety of sources and specifically how you can create form-based programs to access an existing database. In this chapter, you will learn about:
What kind of classes are involved in encapsulating a data source
How you can use the DataGridView control to display your own data
How you can customize the appearance of a DataGridView control
What the function of the BindingSource component is and how you use it with a
DataGridView control
How you use a BindingNavigator control to navigate data from a source managed by a BindingSource control
How you expedite updating of a database using a BindingNavigator control and a
BindingSource component
Visual C++ 2005 provides a high degree of automation for creating Forms-based applications that access data sources but you will start by ignoring the automation and get a feel for how you can work with components programmatically. With this approach, you’ll not only get a good insight into how things work; you’ll also appreciate how much the automation is doing for you.
Working with Data Sources
A data source is any source of data for your application; relational databases, Web services that access data, and objects can all be data sources. When you are developing an application that will work with an existing data source, you will usually need to identify the data source within your project. You’ll do this through the Data Sources window that is displayed when you select Data > Show Data Sources item from the main menu or when you press Shift+Alt+D.