Hi,
When I use sqlcommand.Exec uteXmlReader to receive Sql Server 2005's table
data, it not work! my code is below:
private static void CreateXMLReader (string queryString,str ing
connectionStrin g)
{
using (SqlConnection connection = new SqlConnection(c onnectionString ))
{
connection.Open ();
SqlCommand command = new SqlCommand(quer yString, connection);
System.Xml.XmlR eader reader = command.Execute XmlReader();
}
}
private void button3_Click(o bject sender, EventArgs e)
{
CreateXMLReader ("select * from testtable for xml auto", "Data
Source=SQL2005; Initial Catalog=Test;In tegrated Security=True") ;
}
The reader can be created successfully, and debugger didn't report error,
but the reader is None!! It contains nothing!! Why?? Is there any mistake in
my code? please help me. Thanks.
Risen
When I use sqlcommand.Exec uteXmlReader to receive Sql Server 2005's table
data, it not work! my code is below:
private static void CreateXMLReader (string queryString,str ing
connectionStrin g)
{
using (SqlConnection connection = new SqlConnection(c onnectionString ))
{
connection.Open ();
SqlCommand command = new SqlCommand(quer yString, connection);
System.Xml.XmlR eader reader = command.Execute XmlReader();
}
}
private void button3_Click(o bject sender, EventArgs e)
{
CreateXMLReader ("select * from testtable for xml auto", "Data
Source=SQL2005; Initial Catalog=Test;In tegrated Security=True") ;
}
The reader can be created successfully, and debugger didn't report error,
but the reader is None!! It contains nothing!! Why?? Is there any mistake in
my code? please help me. Thanks.
Risen
Comment