Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private DataSet XmlString2DataSet(string xmlString)
- {
- //create a new DataSet that will hold our values
- DataSet quoteDataSet = null;
- //check if the xmlString is not blank
- if (String.IsNullOrEmpty(xmlString))
- {
- //stop the processing
- return quoteDataSet;
- }
- try
- {
- //create a StringReader object to read our xml string
- using (StringReader stringReader = new StringReader(xmlString))
- {
- //initialize our DataSet
- quoteDataSet = new DataSet();
- //load the StringReader to our DataSet
- quoteDataSet.ReadXml(stringReader);
- }
- }
- catch
- {
- //return null
- quoteDataSet = null;
- }
- //return the DataSet containing the stock information
- return quoteDataSet;
- }
Advertisement
Add Comment
Please, Sign In to add comment