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. Web Development
  3. ASP.NET
  4. using the xmlReader for xml auto in ms sql server

using the xmlReader for xml auto in ms sql server

Scheduled Pinned Locked Moved ASP.NET
databasesql-servergraphicsdesignsysadmin
1 Posts 1 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.
  • J Offline
    J Offline
    jaimecavazos
    wrote on last edited by
    #1

    I've got three records in my database in MS Sql Server 2000 and when I query the records the 1st and last records show up in my xml. Is there any reason why the 2nd record is not showing up? Here's my code: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Xml; namespace web_test_net.for_xml_auto { /// /// Summary description for xml. /// public class xml : System.Web.UI.Page { protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; protected System.Data.SqlClient.SqlCommand sqlSelectCommand1; protected System.Data.SqlClient.SqlCommand sqlInsertCommand1; protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1; protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1; protected System.Data.SqlClient.SqlConnection sqlConnection1; protected string xmlstring; protected XmlReader xmlreader; private void Page_Load(object sender, System.EventArgs e) { sqlConnection1.Open(); xmlreader = sqlDataAdapter1.SelectCommand.ExecuteXmlReader(); while (xmlreader.Read()) { xmlstring += xmlreader.ReadOuterXml(); } //Response.ContentType = "text/xml"; //Response.Write("" + xmlstring + ""); Response.Write("test="+xmlstring); sqlConnection1.Close(); } and my sql command is: select * from test for xml auto If anyone can I would be much appreciated. Thanks in advance!

    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