Dim xRec As New XmlDocument xRec.LoadXml("<NotaryData/>")
' Setupt the command object as needed here
reader = command.ExecuteReader() Dim xNode As XmlNode Dim xAttr As XmlAttribute Dim Flds As Int16 Dim I As Int16 Dim xRow As XmlNode While reader.Read() Flds = reader.FieldCount xRow = xRec.CreateNode(XmlNodeType.Element, "", "Row", "") ' Create a new row to include in the document For I = 0 To Flds - 1 xNode = xRec.CreateNode(XmlNodeType.Element, "", "Data", "") ' Create a field to include in the row xAttr = xRec.CreateAttribute("Name") ' There is a name attribute that is the field name xAttr.Value = Trim(reader.GetName(I)) xNode.InnerText = Trim(reader(I).ToString) ' The text of the element contains the value xNode.Attributes.Append(xAttr) xRow.AppendChild(xNode) ' Append the field to the row Next xRec.DocumentElement.AppendChild(xRow) ' Append the row to the document End While reader.Close() connection.Close()