using the xmlReader for xml for auto in ms sql server
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!