You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data-tools/create-and-configure-datasets-in-visual-studio.md
+32-24Lines changed: 32 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Create and configure datasets
3
3
description: Create and configure datasets in Visual Studio. A dataset is a set of objects that store data from a DB in memory and supports CRUD operations on that data.
4
4
ms.custom: SEO-VS-2020
5
-
ms.date: 11/21/2018
5
+
ms.date: 10/07/2022
6
6
ms.topic: how-to
7
7
helpviewer_keywords:
8
8
- typed datasets, creating
@@ -27,39 +27,47 @@ You can create a typed <xref:System.Data.DataSet> class in Visual Studio at desi
27
27
28
28
1. Open your project in Visual Studio, and then choose **Project** > **Add New Data Source** to start the **Data Source Configuration Wizard**.
29
29
30
-
2. Choose the type of data source to which you'll be connecting.
30
+
1. Choose the type of data source to which you'll be connecting.

33
33
34
-
3. Choose the database or databases that will be the data source for your dataset.
34
+
1. Choose `DataSet` from the list of options.
35
35
36
-

36
+

37
37
38
-
4. Choose the tables (or individual columns), stored procedures, functions, and views from the database that you want to be represented in the dataset.
38
+
1. Choose the database or databases that will be the data source for your dataset.

41
41
42
-
5. Click **Finish**.
42
+
1. Choose whether to save the connection string in *app.config*.
43
+
44
+

45
+
46
+
1. Choose the tables (or individual columns), stored procedures, functions, and views from the database that you want to be represented in the dataset.
47
+
48
+

49
+
50
+
1. Click **Finish**.
43
51
44
52
The dataset appears as a node in **Solution Explorer**.
45
53
46
-

54
+

47
55
48
-
6. Click the dataset node in **Solution Explorer** to open the dataset in the **DataSet Designer**. Each table in the dataset has an associated `TableAdapter` object, which is represented at the bottom. The table adapter is used to populate the dataset and optionally to send commands to the database.
56
+
1. Click the dataset node in **Solution Explorer** to open the dataset in the **DataSet Designer**. Each table in the dataset has an associated `TableAdapter` object, which is represented at the bottom. The table adapter is used to populate the dataset and optionally to send commands to the database.

51
59
52
-
7. The relation lines that connect the tables represent table relationships, as defined in the database. By default, foreign-key constraints in a database are represented as a relation only, with the update and delete rules set to none. Typically, that is what you want. However, you can click the lines to bring up the **Relation** dialog, where you can change the behavior of hierarchical updates. For more information, see [Relationships in datasets](../data-tools/relationships-in-datasets.md) and [Hierarchical update](../data-tools/hierarchical-update.md).
60
+
1. The relation lines that connect the tables represent table relationships, as defined in the database. By default, foreign-key constraints in a database are represented as a relation only, with the update and delete rules set to none. Typically, that is what you want. However, you can click the lines to bring up the **Relation** dialog, where you can change the behavior of hierarchical updates. For more information, see [Relationships in datasets](../data-tools/relationships-in-datasets.md) and [Hierarchical update](../data-tools/hierarchical-update.md).
8. Click a table, table adapter, or column name in a table to see its properties in the **Properties** window. You can modify some of the values here. Just remember that you are modifying the dataset, not the source database.
64
+
1. Click a table, table adapter, or column name in a table to see its properties in the **Properties** window. You can modify some of the values here. Just remember that you are modifying the dataset, not the source database.
9. You can add new tables or table adapters to the dataset, or add new queries for existing table adapters, or specify new relations between tables by dragging those items from the **Toolbox** tab. This tab appears when the **DataSet Designer** is in focus.
68
+
1. You can add new tables or table adapters to the dataset, or add new queries for existing table adapters, or specify new relations between tables by dragging those items from the **Toolbox** tab. This tab appears when the **DataSet Designer** is in focus.
Next, you might want to specify how to populate the dataset with data. For that, you use the **TableAdapter Configuration Wizard**. For more information, see [Fill datasets by using TableAdapters](../data-tools/fill-datasets-by-using-tableadapters.md).
65
73
@@ -69,23 +77,23 @@ This procedure shows how to add a table from the same database that you used to
69
77
70
78
1. Click the dataset node in **Solution Explorer** to bring the **DataSet Designer** into focus.
71
79
72
-
2. Click the **Data Sources** tab in the left margin of Visual Studio, or type **data sources** in the search box.
80
+
1. Click the **Data Sources** tab in the left margin of Visual Studio, or type **data sources** in the search box.
73
81
74
-
3. Right-click the dataset node and select **Configure Data Source with Wizard**.
82
+
1. Right-click the dataset node and select **Configure Data Source with Wizard**.

77
85
78
-
4. Use the wizard to specify which additional tables, stored procedures, or other database objects to add to the dataset.
86
+
1. Use the wizard to specify which additional tables, stored procedures, or other database objects to add to the dataset.
79
87
80
88
## Add a stand-alone data table to a dataset
81
89
82
90
1. Open your dataset in the **Dataset Designer**.
83
91
84
-
2. Drag a <xref:System.Data.DataTable> class from the **DataSet** tab of the **Toolbox** onto the **Dataset Designer**.
92
+
1. Drag a <xref:System.Data.DataTable> class from the **DataSet** tab of the **Toolbox** onto the **Dataset Designer**.
85
93
86
-
3. Add columns to define your data table. Right-click on the table and choose **Add** > **Column**. Use the **Properties** window to set the data type of the column and a key if necessary.
94
+
1. Add columns to define your data table. Right-click on the table and choose **Add** > **Column**. Use the **Properties** window to set the data type of the column and a key if necessary.
87
95
88
-
Stand-alone tables need to Implement`Fill` logic in stand-alone tables so that you can fill them with data. For information on filling stand-alone data tables, see [Populating a DataSet from a DataAdapter](/dotnet/framework/data/adonet/populating-a-dataset-from-a-dataadapter).
96
+
Stand-alone tables need to implement`Fill` logic so that you can fill them with data. For information on filling data tables, see [Populating a DataSet from a DataAdapter](/dotnet/framework/data/adonet/populating-a-dataset-from-a-dataadapter).
0 commit comments