using System;
using System.Data.SqlClient;
using System.IO;
using System.Xml;
public class SaveDataAsXml {
public static void Main(string [] args) {
SqlConnection connection = new SqlConnection("Initial Catalog=Product; Integrated Security=SSPI; User ID=sa");
string command = "SELECT name FROM customers";
SqlCommand xmlCommand = new SqlCommand(command, connection);
connection.Open();
XmlReader reader = xmlCommand.ExecuteXmlReader();
XmlDocument doc = new XmlDocument();
doc.Load(reader);
doc.Save(Console.Out);
connection.Close();
}
}