- 1). Click the Windows "Start" button, and type "visual studio" into the search text box. Press "Enter" to open the NET programming software.
- 2). Open the Visual Studio project and double-click the code file you want to use to load the XML data into the DataSet.
- 3). Create the DataSet object. You create the DataSet object and set up the table within the DataSet to provide a place for the XML to store. Copy and paste the following code to create the DataSet:
Dim dataset As DataSet = New DataSet
Dim table As DataTable = New DataTable("table_1")
table.Columns.Add("XMLColumn", Type.GetType("System.String"))
dataset.Tables.Add(table) - 4). Create the XML to load into the DataSet. The following code shows you how to create an XML object before you load it into the DataSet:
Dim xml As String = "<XmlDS><table_1><XMLColumn>My Value</XMLColumn></table_1></XmlDS>"
Dim reader As System.IO.StringReader = New System.IO.StringReader(xml) - 5). Load the XML into the DataSet. The example in Step 4 has one XML record to import. Use the following ReadXML function to load the XML:
dataset.ReadXml(reader, XmlReadMode.IgnoreSchema)
SHARE