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. XML / XSL
  4. Problem with loading a xml to DataSet

Problem with loading a xml to DataSet

Scheduled Pinned Locked Moved XML / XSL
helpquestionxml
2 Posts 2 Posters 2 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.
  • A Offline
    A Offline
    alireza_shokoie
    wrote on last edited by
    #1

    Hi all, I've xml string and I can load it with XmlDataDocument.LoadXml successfully, so that OuterXml shows the real xml string. But when I want to load in a dataset, the result dataset has no table(Tables.Count=0). Typical code is as follows: ... XmlDataDocument Doc = new XmlDataDocument(); /* string Str = "<Result><DN>22800661</DN><ID>1</ID><Status><Line>Idle</Line></Status></Result>"; */ Doc.LoadXml(Str); DataSet datasetResult = Doc.DataSet; if(datasetResult.Tables.Count == 0) return; ... and it returns that means datasetResult.Tables.Count is always 0. Can anyone help me, what is wrong? Thanks in advance

    D 1 Reply Last reply
    0
    • A alireza_shokoie

      Hi all, I've xml string and I can load it with XmlDataDocument.LoadXml successfully, so that OuterXml shows the real xml string. But when I want to load in a dataset, the result dataset has no table(Tables.Count=0). Typical code is as follows: ... XmlDataDocument Doc = new XmlDataDocument(); /* string Str = "<Result><DN>22800661</DN><ID>1</ID><Status><Line>Idle</Line></Status></Result>"; */ Doc.LoadXml(Str); DataSet datasetResult = Doc.DataSet; if(datasetResult.Tables.Count == 0) return; ... and it returns that means datasetResult.Tables.Count is always 0. Can anyone help me, what is wrong? Thanks in advance

      D Offline
      D Offline
      daveyerwin
      wrote on last edited by
      #2

      Maybe this is what you want ? string Str = "228006611Idle"; System.IO.StringReader sr = new System.IO.StringReader(Str); XmlDataDocument Doc = new XmlDataDocument(); Doc.DataSet.ReadXml(sr); DataSet datasetResult = Doc.DataSet; if (datasetResult.Tables.Count == 0) return;

      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