Hi,
When I use sqlcommand.ExecuteXmlReader to receive Sql Server 2005's table
data, it not work! my code is below:
private static void CreateXMLReader(string queryString,string
connectionString)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand(queryString, connection);
System.Xml.XmlReader reader = command.ExecuteXmlReader();
}
}
private void button3_Click(object sender, EventArgs e)
{
CreateXMLReader("select * from testtable for xml auto", "Data
Source=SQL2005;Initial Catalog=Test;Integrated 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