Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Reading XML String into DataSet (VB.NET)

Reading XML String into DataSet (VB.NET)

Scheduled Pinned Locked Moved Visual Basic
helpcsharpxmltutorial
5 Posts 3 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nic Rowan
    wrote on last edited by
    #1

    Heya, I'm having a bit of a problem. I have a XML string which I can read into an XML Document but I can't figure out how to get the data into a DataSet :-O. The dataset is looking for a stream or xmlreader and I'm not a 100% sure on how these work... Any help would be appreciated thanks :)


    The man who smiles when things go wrong has thought of someone he can blame it on. If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.


    J G 2 Replies Last reply
    0
    • N Nic Rowan

      Heya, I'm having a bit of a problem. I have a XML string which I can read into an XML Document but I can't figure out how to get the data into a DataSet :-O. The dataset is looking for a stream or xmlreader and I'm not a 100% sure on how these work... Any help would be appreciated thanks :)


      The man who smiles when things go wrong has thought of someone he can blame it on. If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.


      J Offline
      J Offline
      Jim Taylor
      wrote on last edited by
      #2

      This code works for me: In my app oResultsNode is the document element of an xml document. Private Function GetResults(ByVal oResultsNode As XmlNode) As DataSet If Not oResultsNode Is Nothing Then Dim dsResults As New DataSet Dim oXmlNodeReader As New XmlNodeReader(oResultsNode) dsResults.ReadXml(oXmlNodeReader, XmlReadMode.InferSchema) Return dsResults End If End Function Jim

      N 1 Reply Last reply
      0
      • N Nic Rowan

        Heya, I'm having a bit of a problem. I have a XML string which I can read into an XML Document but I can't figure out how to get the data into a DataSet :-O. The dataset is looking for a stream or xmlreader and I'm not a 100% sure on how these work... Any help would be appreciated thanks :)


        The man who smiles when things go wrong has thought of someone he can blame it on. If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.


        G Offline
        G Offline
        Guillermo Rivero
        wrote on last edited by
        #3

        Dim vReader As New IO.StringReader(vString) Dim vSet as new DataSet() vSet.ReadXml(vReader) :) Free your mind...

        N 1 Reply Last reply
        0
        • J Jim Taylor

          This code works for me: In my app oResultsNode is the document element of an xml document. Private Function GetResults(ByVal oResultsNode As XmlNode) As DataSet If Not oResultsNode Is Nothing Then Dim dsResults As New DataSet Dim oXmlNodeReader As New XmlNodeReader(oResultsNode) dsResults.ReadXml(oXmlNodeReader, XmlReadMode.InferSchema) Return dsResults End If End Function Jim

          N Offline
          N Offline
          Nic Rowan
          wrote on last edited by
          #4

          Cool thanks, I'll give it a try :)


          The man who smiles when things go wrong has thought of someone he can blame it on. If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.


          1 Reply Last reply
          0
          • G Guillermo Rivero

            Dim vReader As New IO.StringReader(vString) Dim vSet as new DataSet() vSet.ReadXml(vReader) :) Free your mind...

            N Offline
            N Offline
            Nic Rowan
            wrote on last edited by
            #5

            :doh: And here I was trying to get the XmlParserContext, XMLReader and XMLNamespaceManager to all talk to each other... (it eventually worked but my lordy it was NOT pretty) Thanks man, I'll give it a try now :-D


            The man who smiles when things go wrong has thought of someone he can blame it on. If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.


            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups