Hey everyone, I have a function that reads XML data and converts it into a string, is there anyway to convert this to read from a SQL database while keeping the same functionality? This code is part of an Autofill user control. Here is the code:
Thanks for your help!!!
Code:
Private Function GetFilteredData(ByVal filter As String) As DataTable Dim users As String = _ "<users>" & _ "<usertable><userid>1</userid><username>John Doe</username></usertable>" & _ "<usertable><userid>2</userid><username>Jane Doe</username></usertable>" & _ "<usertable><userid>3</userid><username>Ant Hill</username></usertable>" & _ "<usertable><userid>4</userid><username>Ben Ten</username></usertable>" & _ "<usertable><userid>5</userid><username>Craig List</username></usertable>" & _ "<usertable><userid>6</userid><username>Godfrey Jones</username></usertable>" & _ "<usertable><userid>7</userid><username>Tonya Roberts</username></usertable>" & _ "</users>" Dim ds As New DataSet Dim xReader As System.IO.StringReader = New System.IO.StringReader(users) ds.ReadXml(xReader, XmlReadMode.Auto) Return ConvertDataRowArrayToDataTable(ds.Tables(0).Select(filter)) End Function
Thanks for your help!!!
Comment