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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. problem in reading the xml in vb.net

problem in reading the xml in vb.net

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdatabasesql-serversysadmin
2 Posts 2 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.
  • N Offline
    N Offline
    nileshbahirshet
    wrote on last edited by
    #1

    I want to read the xml data from the sql server 2005 by using vb.net I have xmltest table in datatbase and the data column which has the xml datatype but I have a code of reading the xml data as follows conn.Open(); SqlCommand command = conn.CreateCommand(); System.Text.StringBuilder builder = new System.Text.StringBuilder(); command.CommandText = "SELECT XmlDesc FROM XmlTest WHERE ID = " + ID.ToString(); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { 1)how to use in vb.net ? -----> SqlXml sqlXmlValue = reader.GetSqlXml(0); XmlReader xmlReader = sqlXmlValue.CreateReader(); while (xmlReader.Read()) { 2) How to use in vb.NET ---> builder.Append(xmlReader.ReadString()); builder.Append(" "); } txtXmlDesc.Text = builder.ToString(); } else txtXmlDesc.Text = "No Value"; now I want to convert this code in to vb.NET what shoud I use at 1 and 2 ? insted of SQLXml which is in c# what should I use in vb.net ?

    N 1 Reply Last reply
    0
    • N nileshbahirshet

      I want to read the xml data from the sql server 2005 by using vb.net I have xmltest table in datatbase and the data column which has the xml datatype but I have a code of reading the xml data as follows conn.Open(); SqlCommand command = conn.CreateCommand(); System.Text.StringBuilder builder = new System.Text.StringBuilder(); command.CommandText = "SELECT XmlDesc FROM XmlTest WHERE ID = " + ID.ToString(); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { 1)how to use in vb.net ? -----> SqlXml sqlXmlValue = reader.GetSqlXml(0); XmlReader xmlReader = sqlXmlValue.CreateReader(); while (xmlReader.Read()) { 2) How to use in vb.NET ---> builder.Append(xmlReader.ReadString()); builder.Append(" "); } txtXmlDesc.Text = builder.ToString(); } else txtXmlDesc.Text = "No Value"; now I want to convert this code in to vb.NET what shoud I use at 1 and 2 ? insted of SQLXml which is in c# what should I use in vb.net ?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      nileshbahirshet wrote:

      insted of SQLXml which is in c# what should I use in vb.net ?

      SqlXml is a .NET class not specific to C#. IMO stick with C#, VB is dead and VB.NET is a poor attempt to keep VBers relevant.


      only two letters away from being an asset

      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