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

Other versions are also available for the following:
Data Access in Client and Middle-Tier Programming
Data Sources Window

Updated: November 2007

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:

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.

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.

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.

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.

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.

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.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Data Source Wizard vanishes      normUIguy   |   Edit   |  
I'm trying to add the northwind DB as a data source (following the VB intro video), and after clicking on "new connection", the wizard disappears without a trace. No error message; not even a puff of smoke. (Nice trick, even for a wizard). However, I would prefer that the wizard complete its performance and allow me to add the northwind db. any suggestions?

thanks,

norm
No Data menu in my open projcet?      Spyder2000 ... Thomas Lee   |   Edit   |  

This is a wonderful page that perfectly describes what I would like to do in my web form. However once I have a project open, I have no Data Menu from which to start this process. I have found that I can get the "Server Explorer" to display my data source but that does not allow me to associate the types of controls I would like to use, with the individual fields in the table. Did Server Explorer replace Data Sources, if so then how do I associate controls and fields. Or did I do something wrong to get into this bind? Thanks for any suggestions. Spyder


[tfl - 25 June 08] - You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn. You are likely get a quicker response through the forum than through the Community Content. Also, removing contentbug tag as this does not appear to be a content bug.

Data bound to "Interface"      linze   |   Edit   |  

interface IBase
{
string FA { get; set; }
}
interface IInherit : IBase
{
string FB { get; set; }
}

at the "Data Source window", when choose "IInherit" as data source type for data-bound .I get the field list only include "FB",not expected "FA, FB" .

when "interface"replace with "class",it work rightly.

Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker