How to Use Data Sources with Databases (Page 1 of 5 )
Visual Studio 2005 has some excellent features for working with data, but there are some things you need to do before you can use them. This article, the first of two parts, explains. It is excerpted from chapter 14 of the book
Murach's Visual Basic 2005, written by Anne Boehm (Murach, 2006; ISBN: 1890774383).
How to create a data source
Before you can take advantage of Visual Studio 2005’s new features for working with data, you must create a data source for the application. As its name implies, a data source specifies the source of the data for an application. Since most applications get their data from a database, the next five figures show how to create a data source that gets data from a database.
How to use the Data Sources window
The data sources that are available to a project are listed in the Data Sources window as shown in figure 14-1. Here, the second screen shows a data source for the Products table that’s available from the MMABooks database described in the previous chapter. As you can see, this data source includes three columns from the Products table named ProductCode, Description, and UnitPrice.
If no data sources are available to a project, the Data Sources window will display an Add New Data Source link as shown in the first screen. Then, you can click on this link to start the Data Source Configuration Wizard described in figures 14-2 through 14-4. This wizard lets you add a new data source to the project. When you’re done, you can drag the data source onto a form to create bound controls as described later in this chapter.
An empty Data Sources window

A Data Sources window after a data source has been added

Description - A data source shows all the tables and columns in the dataset that are available to your application.
- You can display the Data Sources window by clicking on the Data Sources tab that’s usually grouped with the Solution Explorer at the right edge of the Visual Studio window or by selecting the Show Data Sources command from the Data menu.
- To create a data source, you can click the Add New Data Source link. Then, you can drag the data source to a form to create controls that are bound to the data source.
Figure 14-1. How to use the Data Sources window
Next: How to start the Data Source Configuration Wizard >>
More Visual Basic.NET Articles
More By Murach Publishing
|
This article is excerpted from chapter 14 of the book Murach's Visual Basic 2005, written by Anne Boehm (Murach, 2006; ISBN: 1890774383). Check it out today at your favorite bookstore. Buy this book now.
|
|