How do I get XML from a variable into a DataSet?
You can use the System.IO.StringReader class to get XML from a variable into a DataSet. For example, if you have a string variable named EmployeeXml that contains XML, you can get it into a DataSet as follows:
In C#:
DataSet ds = new DataSet(); ds.ReadXml(new XmlTextReader(new StringReader(employeeXML)));
In VB .NET:
Dim ds As New DataSet() ds.ReadXml(New XmlTextReader(New StringReader(employeeXML)))
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 07/29/18
Comment or report problem with topic
