ADO Net C# Tutorial

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlXml;
using System.IO;
    public class MainClass
    {
        public static void Main()
        {
            try
            {
                string strConn = @"Provider=SQLOLEDB;server=.\sqlexpress;database=northwind;integrated security=SSPI";
                SqlXmlCommand cmd = new SqlXmlCommand(strConn);
                cmd.CommandText = "select * from employee";
                Stream stream = cmd.ExecuteStream();
                StreamReader reader = new StreamReader(stream);
                StreamWriter writer = File.CreateText(Application.StartupPath + @"\sqlxmlresults.xml");
                writer.Write(reader.ReadToEnd());
                writer.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }