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. C / C++ / MFC
  4. XML string to DataTable

XML string to DataTable

Scheduled Pinned Locked Moved C / C++ / MFC
xmldatabasehelpquestion
2 Posts 1 Posters 1 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.
  • L Offline
    L Offline
    lsugirljte
    wrote on last edited by
    #1

    Hi, I'm trying to do something that seems pretty easy. I have a xml string that I want in a datatable. I think the biggest problem is with getting the schems into the datatable. I can't use the Path.xsd because I don't know it at this point. I want to read the schema from the xml string. public void XMLStringToDataTable(string as_xml, ref DataTable adt_working) { if (adt_working == null) adt_working = new DataTable(); StringReader lstr_temp = new StringReader(as_xml); XmlTextReader lxmlReader = new XmlTextReader(lstr_temp); adt_working.ReadXmlSchema(lxmlReader); adt_working.ReadXml(lxmlReader); adt_working.AcceptChanges(); } Is there any easier/ better way to do this? One that works? I would like to use a datatable instead of a dataset if possible. sample xml string: 62291905/4/2006 00:00:002test5/4/2006 00:00:00N16471678 Thanks, Jessica

    L 1 Reply Last reply
    0
    • L lsugirljte

      Hi, I'm trying to do something that seems pretty easy. I have a xml string that I want in a datatable. I think the biggest problem is with getting the schems into the datatable. I can't use the Path.xsd because I don't know it at this point. I want to read the schema from the xml string. public void XMLStringToDataTable(string as_xml, ref DataTable adt_working) { if (adt_working == null) adt_working = new DataTable(); StringReader lstr_temp = new StringReader(as_xml); XmlTextReader lxmlReader = new XmlTextReader(lstr_temp); adt_working.ReadXmlSchema(lxmlReader); adt_working.ReadXml(lxmlReader); adt_working.AcceptChanges(); } Is there any easier/ better way to do this? One that works? I would like to use a datatable instead of a dataset if possible. sample xml string: 62291905/4/2006 00:00:002test5/4/2006 00:00:00N16471678 Thanks, Jessica

      L Offline
      L Offline
      lsugirljte
      wrote on last edited by
      #2

      sorry about the xml string sample. That didn't work how I wanted it to. Thanks, Jessica -- modified at 12:29 Thursday 4th May, 2006

      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