Data Source Configuration Wizard
The Data Source Configuration Wizard creates and edits data sources in your application. These data sources can be made from databases, Web services, or objects, and can be bound to controls that display data on forms. For more information, see Data Sources Overview.
After you run the wizard, the data source is available in the Data Sources window for dragging onto forms in Windows applications. For more information, see Displaying Data on Forms in Windows Applications.
Running the Wizard
You can run the wizard in any of the following ways:
-
Choosing Add New Data Source from the Data menu.
-
Choosing Add New Data Source from the Data Sources Window.
-
Choosing Add New Data Source from the DataSource property of bindable Windows Forms controls.
Depending on the selected data source type (database, Web service, or object) the wizard will begin on any one of a number of pages in the wizard. For information on a specific page, select from the following list:
Choose a Data Source Type
Select the type of data source to create from the available options listed on the Choose a Data Source Type page. Currently supported data source types include databases, Web services, and objects. The end result of running the wizard is determined by the type of data source selected.
The following table shows the results of selecting each type:
| Data source type | Description | Result in project |
|---|---|---|
| Database | Enables your application to connect and manipulate data in database products, such as Microsoft SQL Server. | A typed dataset (.xsd file). |
| Web service | Enables your application to connect and work with the data and methods of a Web service. | Because Web services can return many different types of objects, the resulting data source is determined by the objects returned from the Web service. |
| Object | Enables your application to work with data in existing objects. | If the object is not located in the project, you must add a reference to the selected object for it to appear in the wizard. |
Choose Your Data Connection
Choose an existing connection from the list of connections or click New Connection to open the Add/Modify Connection Dialog Box (General) and create a connection to your database.
Upon completion of the Connection Properties dialog box, the Connection Details area displays read-only information about the selected provider as well as the connection string.
Save connection string to the application configuration file
Choose Yes, save the connection as to store the connection string in the application configuration file. Type a name for the connection or use the provided default name.
Saving connection strings in the application configuration file simplifies the process of maintaining your application if the database connection changes. In the event of a change in the database connection you can edit the connection string in the application configuration file as opposed to editing the source code and having to recompile your application. For information on editing a connection string in the application configuration file, see How to: Edit a Connection String.
Security Note |
|---|
| Information is stored in the application configuration file as plain text. To reduce the possibility of unauthorized access to sensitive information, you may want to encrypt your data. For more information, see Encrypting and Decrypting Data. |
Choose Your Database Objects
From the available objects displayed in the tree view, select the objects from your database to bring into the application, and provide a name for the dataset in the Dataset name box.
Tip |
|---|
| The window can be resized if necessary. |
Add Web Reference
Completing the Add Web Reference page of the wizard adds a reference to the Web service in your project and populates the Data Sources window with objects returned from the Web service. The data source created from the Web service contains the items returned from the Web service. For example, if the Web service returns a typed dataset, then the data source created is the dataset, whereas if the Web service returns a type, then the data source is the type returned. For more information, see Add Web Reference Dialog Box.
Note |
|---|
| The items that appear in the Data Sources window are dependent on the information that the Web service returns. Some Web services might not provide enough information for the Data Source Configuration Wizard to create bindable objects. For example, if the Web service returns an untyped dataset, then no items will appear in the Data Sources window upon completion of the wizard. This is because untyped datasets do not provide schema, so the wizard does not have enough information to create the data source. |
Select an Object you wish to bind to
Select the object to bind to from the tree view. The tree view only displays objects currently in your application. To bind an object external to your application, you must first add a reference from your application to the external object. To add references to external assemblies, click Add Reference on the Project menu, and then select the assembly you want in the Add Reference Dialog Box. After adding the reference, navigate in the tree view to the type you want and click Next.
Note |
|---|
| If the object you want does not appear in the wizard, build the project that contains your object and restart the wizard. |
See Also
Tasks
How to: Create TableAdaptersHow to: Create TableAdapter Queries
Concepts
TableAdapter OverviewOther Resources
Getting Started with Data AccessConnecting to Data in Visual Studio
Preparing Your Application to Receive Data
Fetching Data into Your Application
Displaying Data on Forms in Windows Applications
Editing Data in Your Application
Validating Data
Saving Data
Security Note
Tip