Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Accessing Data
 Data Sources Window
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:

Want more? Here are some additional resources on this topic:

Data Access in Client and Middle-Tier Programming 
Data Sources Window 

The Data Sources window displays the data sources in your project. You can use the Data Sources window to create a user interface (consisting of data-bound controls) by dragging items from the window onto forms in your project. Each item has a drop-down control list where you can select the type of control to create prior to dragging it onto a form. You can customize the control list with additional controls, including controls that you have created.

Data Sources Window

Using the Data Sources window, you can:

Opening the Data Sources Window

You display the Data Sources window by clicking Show Data Sources on the Data menu. The Data menu is only available when a project is open in Visual Studio.

Populating the Data Sources Window

You populate the Data Sources window by adding data sources to your project. To add new data sources with the Data Source Configuration Wizard, click Add New Data Source on the Data menu or click the Add New Data Source link in the Data Sources window.

You can also populate the window by adding DataSet items to your project using the Dataset Designer. For more information, see the "To create a dataset with the Dataset Designer" section of How to: Create a Typed Dataset.

Creating Data-bound Controls

You can drag an item from the Data Sources window onto a form to create a new data-bound control, or you can drag an item from the Data Sources window onto an existing control to set up the data binding between the control and the item dragged onto it. Each node in the Data Sources window allows you to choose the type of control that will be created when you drag it onto a form. You must choose between a Grid layout, where all columns or properties are displayed in a DataGridView, or a Details layout, where all columns or properties are displayed in individual controls. You can choose the control to be created prior to dragging by selecting an item in the Data Sources window and choosing the control from the item's drop-down control list.

Creating Data-bound Controls That Display Related Records

Data Sources Window showing relation

The Data Sources window displays related tables in a hierarchical tree view. For example, in a dataset with Customers and Orders tables (where a customer can have many orders), the Orders table appears as the last column in the Customers table as an expandable node. To display data from this related table and set up the data binding to display the related orders for a selected customer, you would drag items from this related tree view (as opposed to items from the individual top-level nodes for Customers and Orders). For more information, see How to: Display Related Data in a Windows Application.

Commands Available in the Data Sources Window

The following commands are available when you right-click the Data Sources window:

Add New Data Source

Opens the Data Source Configuration Wizard, which assists you in creating new data sources in your project.

Edit DataSet with Designer

Opens the selected dataset in the Dataset Designer. For more information, see How to: Edit a Dataset.

Configure DataSet with Wizard

Opens the Data Source Configuration Wizard populated with information from the selected data source.

Refresh

Synchronizes the Data Sources window with the data sources in your project.

Removing Data Sources from the Data Sources Window

The items in the Data Sources window are synchronized with your project, so removing an item from a project will be reflected in the Data Sources window. For example, if your project has a data source based on a Web service, removing the Web reference from your project also removes the Web service data source from the Data Sources window. For more information, see How to: Remove Data Sources from the Data Sources Window.

See Also

Community Content   What is Community Content?
Add new content RSS  Annotations
Data Sources Window becomes inactive in Design View after uninstalling Visual Studio 2005 Beta 2 and installing Visual Studio 2005 RTM      HuyN_MS   |   Edit   |   Show History

After uninstalling Visual Studio 2005 Beta 2 and installing Visual Studio 2005 RTM, the content of the Data Sources Window may disappear when a designer surface (for example the Windows Forms Form designer, User Control designer) is active. This Smart Client Data blog explains the reason and shows how to fix the problem.

http://blogs.msdn.com/smartclientdata/archive/2005/11/18/494639.aspx

Tags What's this?: Add a tag
Flag as ContentBug
Data Sources      Marc Schluper   |   Edit   |   Show History

You write "You display the Data Sources window by clicking Show Data Sources on the Data menu. The Data menu is only available when a project is open in Visual Studio.".

The Data menu is not always available when a project is open. Try "Shift+Alt+D" when a Report is displayed.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker