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#
  4. Problem with reteriving xml data from sql data base.

Problem with reteriving xml data from sql data base.

Scheduled Pinned Locked Moved C#
csharpdatabasexmlhelp
2 Posts 2 Posters 0 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.
  • P Offline
    P Offline
    prasadbuddhika
    wrote on last edited by
    #1

    I have a table which have a filed which is xml type, and some more fields such as name and id.i want to read the xml field as well as the other fields in C#, i searched and got this

    XmlReader rdr = cmd.ExecuteXmlReader();

    but i want to get the other data in the table too. is there any option to do this using one command , or do i have to call two times to get the data. any idea. thanks in advance.

    A 1 Reply Last reply
    0
    • P prasadbuddhika

      I have a table which have a filed which is xml type, and some more fields such as name and id.i want to read the xml field as well as the other fields in C#, i searched and got this

      XmlReader rdr = cmd.ExecuteXmlReader();

      but i want to get the other data in the table too. is there any option to do this using one command , or do i have to call two times to get the data. any idea. thanks in advance.

      A Offline
      A Offline
      abhinish
      wrote on last edited by
      #2

      XmlDocument document = new XmlDocument();
      using (SqlDataReader dr = oComm.ExecuteReader())
      {
      if (dr.Read())
      {
      if (!dr.IsDBNull(0))
      document.Load(dr.GetSqlXml(0).CreateReader());
      }
      }

      I think this is what you want

      abhinav

      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