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
# Additional resources for troubleshooting data access errors
230
+
# Troubleshoot data access errors on the forums
232
231
233
-
You can find assistance with troubleshooting errors and warnings in the Microsoft Developer Network (MSDN) public forums. The following table lists the data-related forums available on MSDN.
232
+
You can find assistance with troubleshooting errors and warnings in the Microsoft Developer Network (MSDN) public forums. Here are some data-related forums available on MSDN:
234
233
235
-
[Windows forms data controls and databinding](http://go.microsoft.com/fwlink/?LinkId=160179)
236
-
Provides a forum for questions about and general discussions of data access in Windows Forms.
234
+
-[Windows Forms data controls and databinding](https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winformsdatacontrols)
[ADO.NET entity framework and LINQ to entities](http://go.microsoft.com/fwlink/?LinkId=191520)
242
-
Provides a forum for questions about and general discussions of Entity Framework applications and the LINQ to Entities language.
238
+
-[ADO.NET Entity Framework and LINQ to Entities](https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetentityframework)
243
239
244
-
[WCF data services forum](http://go.microsoft.com/fwlink/?LinkId=160181)
245
-
Provides a forum for questions about and general discussions of data services.
240
+
-[WCF data services forum](https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataservices)
246
241
247
-
[SQL Server data access forum](http://go.microsoft.com/fwlink/?LinkID=160184)
248
-
Provides a forum for questions about and general discussions of accessing data in Microsoft SQL Server.
242
+
-[SQL Server data access forum](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqldataaccess)
249
243
250
-
[LINQ to SQL forum](http://go.microsoft.com/fwlink/?LinkId=160183)
251
-
Provides a forum for questions about and general discussions of LINQ to SQL.
244
+
-[LINQ to SQL forum](https://social.msdn.microsoft.com/Forums/en-US/home?forum=linqtosql)
252
245
253
-
[ADO.NET data providers forum](http://go.microsoft.com/fwlink/?LinkId=160182)
254
-
Provides a forum for questions about and general discussions of the different .NET Framework Data Providers.
246
+
-[ADO.NET data providers forum](https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataproviders)
255
247
256
-
For information about how to troubleshoot connectivity to SQL Server, see [How to troubleshoot connecting to the SQL Server database engine](http://go.microsoft.com/fwlink/?LinkID=246151).
248
+
For information about how to troubleshoot connectivity to SQL Server, see [Troubleshoot connecting to the SQL Server database engine](https://social.technet.microsoft.com/wiki/contents/articles/2102.how-to-troubleshoot-connecting-to-the-sql-server-database-engine.aspx).
Copy file name to clipboardExpand all lines: docs/data-tools/read-xml-data-into-a-dataset.md
+24-39Lines changed: 24 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -24,50 +24,37 @@ ms.workload:
24
24
- "data-storage"
25
25
---
26
26
# Read XML data into a dataset
27
-
ADO.NET provides simple methods for working with XML data. In this walkthrough, you create a Windows application that loads XML data into a dataset. The dataset is then displayed in a <xref:System.Windows.Forms.DataGridView> control. Finally, an XML schema based on the contents of the XML file is displayed in a text box.
28
27
29
-
This walkthrough consists of five main steps:
30
-
31
-
1. Creating a new project
32
-
33
-
2. Creating an XML file to be read into the dataset
34
-
35
-
3. Creating the user interface
36
-
37
-
4. Creating the dataset, reading the XML file, and displaying it in a <xref:System.Windows.Forms.DataGridView> control
38
-
39
-
5. Adding code to display the XML schema based on the XML file in a <xref:System.Windows.Forms.TextBox> control
28
+
ADO.NET provides simple methods for working with XML data. In this walkthrough, you create a Windows application that loads XML data into a dataset. The dataset is then displayed in a <xref:System.Windows.Forms.DataGridView> control. Finally, an XML schema based on the contents of the XML file is displayed in a text box.
40
29
41
30
> [!NOTE]
42
-
> The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or the edition you're using. To change your settings, on the **Tools** menu, select **Import and Export Settings**. For more information, see [Personalize the Visual Studio IDE](../ide/personalizing-the-visual-studio-ide.md).
31
+
> The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or the edition you're using. To change your settings, on the **Tools** menu, select **Import and Export Settings**. For more information, see [Personalize the Visual Studio IDE](../ide/personalizing-the-visual-studio-ide.md).
43
32
44
33
## Create a new project
45
-
In this step, you create a Visual Basic or Visual C# project that contains this walkthrough.
46
34
47
-
#### To create the new Windows project
35
+
In this step, you create a Visual Basic or Visual C# project.
48
36
49
-
1. In Visual Studio, on the **File** menu, select **New**, **Project...**.
37
+
1. In Visual Studio, on the **File** menu, select **New** > **Project**.
50
38
51
39
2. Expand either **Visual C#** or **Visual Basic** in the left-hand pane, then select **Windows Desktop**.
52
40
53
41
3. In the middle pane, select the **Windows Forms App** project type.
54
42
55
43
4. Name the project **ReadingXML**, and then choose **OK**.
56
44
57
-
The **ReadingXML** project is created and added to **Solution Explorer**.
45
+
The **ReadingXML** project is created and added to **Solution Explorer**.
58
46
59
47
## Generate the XML file to be read into the dataset
60
-
Because this walkthrough focuses on reading XML data into a dataset, the contents of an XML file is provided.
61
48
62
-
#### To create the XML file that will be read into the dataset
49
+
Because this walkthrough focuses on reading XML data into a dataset, the contents of an XML file is provided.
63
50
64
51
1. On the **Project** menu, select **Add New Item**.
65
52
66
-
2. Select **XML File**, name the file `authors.xml`, and then select **Add**.
53
+
2. Select **XML File**, name the file **authors.xml**, and then select **Add**.
67
54
68
-
The XML file loads into the designer and is ready for edit.
55
+
The XML file loads into the designer and is ready for edit.
69
56
70
-
3. Paste the following code into the editor below the XML declaration:
57
+
3. Paste the following XML data into the editor below the XML declaration:
71
58
72
59
```xml
73
60
<Authors_Table>
@@ -132,7 +119,8 @@ ADO.NET provides simple methods for working with XML data. In this walkthrough,
132
119
4. On the **File** menu, select **Save authors.xml**.
133
120
134
121
## Create the user interface
135
-
The user interface for this application consists of the following:
122
+
123
+
The user interface for this application consists of the following:
136
124
137
125
- A <xref:System.Windows.Forms.DataGridView> control that displays the contents of the XML file as data.
138
126
@@ -144,7 +132,7 @@ ADO.NET provides simple methods for working with XML data. In this walkthrough,
144
132
145
133
- A second button extracts the schema from the dataset, and through a <xref:System.IO.StringWriter> displays it in the <xref:System.Windows.Forms.TextBox> control.
146
134
147
-
#### To add controls to the form
135
+
### To add controls to the form
148
136
149
137
1. Open `Form1` in design view.
150
138
@@ -168,9 +156,8 @@ ADO.NET provides simple methods for working with XML data. In this walkthrough,
168
156
||**Text**|`Show Schema`|
169
157
170
158
## Create the dataset that receives the XML data
171
-
In this step, you create a new dataset named `authors`. For more information about datasets, see [Dataset tools in Visual Studio](../data-tools/dataset-tools-in-visual-studio.md).
172
159
173
-
#### To create a new dataset that receives the XML data
160
+
In this step, you create a new dataset named `authors`. For more information about datasets, see [Dataset tools in Visual Studio](../data-tools/dataset-tools-in-visual-studio.md).
174
161
175
162
1. In **Solution Explorer**, select the source file for **Form1**, and then select the **View Designer** button on the **Solution Explorer** toolbar.
176
163
@@ -183,11 +170,10 @@ ADO.NET provides simple methods for working with XML data. In this walkthrough,
183
170
4. In the **Properties** window, set the **Name** and <xref:System.Data.DataSet.DataSetName%2A> properties for`AuthorsDataSet`.
184
171
185
172
## Create the event handler to read the XML file into the dataset
186
-
The **Read XML** button reads the XML file into the dataset. It then sets properties on the <xref:System.Windows.Forms.DataGridView> control that bind it to the dataset.
187
173
188
-
#### To add code to the ReadXmlButton_Click event handler
174
+
The **Read XML** button reads the XML file into the dataset. It then sets properties on the <xref:System.Windows.Forms.DataGridView> control that bind it to the dataset.
189
175
190
-
1. In **Solution Explorer**, select **Form1**, and then select the **View Designer** button on the **Solution Explorer** toolbar.
176
+
1. In **Solution Explorer**, select **Form1**, and then select the **View Designer** button on the **Solution Explorer** toolbar.
191
177
192
178
2. Select the **Read XML** button.
193
179
@@ -201,25 +187,23 @@ ADO.NET provides simple methods for working with XML data. In this walkthrough,
201
187
4. In the `ReadXMLButton_Click` event handler code, change the `filepath =` entry to the correct path.
202
188
203
189
## Create the event handler to display the schema in the textbox
204
-
The **Show Schema** button creates a <xref:System.IO.StringWriter> object that's filled with the schema and is displayed in the <xref:System.Windows.Forms.TextBox>control.
205
190
206
-
#### To add code to the ShowSchemaButton_Click event handler
191
+
The **Show Schema** button creates a <xref:System.IO.StringWriter> object that's filled with the schema and is displayed in the <xref:System.Windows.Forms.TextBox>control.
207
192
208
193
1. In **Solution Explorer**, select **Form1**, and then select the **View Designer** button.
209
194
210
195
2. Select the **Show Schema** button.
211
196
212
197
The **Code Editor** opens at the `ShowSchemaButton_Click` event handler.
213
198
214
-
3. Type the following code into the `ShowSchemaButton_Click` event handler.
199
+
3. Paste the following code into the `ShowSchemaButton_Click` event handler.
You can now test the form to make sure it behaves as expected.
221
205
222
-
#### To test the form
206
+
You can now test the form to make sure it behaves as expected.
223
207
224
208
1. Select **F5** to run the application.
225
209
@@ -231,14 +215,15 @@ ADO.NET provides simple methods for working with XML data. In this walkthrough,
231
215
232
216
The text box displays the XML schema for the XML file.
233
217
234
-
## Next Steps
235
-
This walkthrough teaches you the basics of reading an XML file into a dataset, as well as creating a schema based on the contents of the XML file. Here are some tasks that you might do next:
218
+
## Next steps
219
+
220
+
This walkthrough teaches you the basics of reading an XML file into a dataset, as well as creating a schema based on the contents of the XML file. Here are some tasks that you might do next:
236
221
237
222
- Edit the data in the dataset and write it back out as XML. For more information, see <xref:System.Data.DataSet.WriteXml%2A>.
238
223
239
-
- Edit the data in the dataset and write it out to a database. For more information, see [Saving Data](../data-tools/saving-data.md).
224
+
- Edit the data in the dataset and write it out to a database.
240
225
241
226
## See also
242
227
243
-
- [Accessing data in Visual Studio](../data-tools/accessing-data-in-visual-studio.md)
244
-
- [XML Tools in Visual Studio](../xml-tools/xml-tools-in-visual-studio.md)
228
+
- [Access data in Visual Studio](../data-tools/accessing-data-in-visual-studio.md)
229
+
- [XML tools in Visual Studio](../xml-tools/xml-tools-in-visual-studio.md)
0 commit comments