using System.Data;
using System.Data.SqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con;
        SqlDataAdapter da;
        DataSet ds;
        string strXmlData;
        string strCon;
        strCon = "Select * From student";
        con = new SqlConnection("Data Source=GHOMI-PC;Initial Catalog=university;Integrated Security=True");
        da = new SqlDataAdapter(strCon, con);
        ds = new DataSet();
        da.Fill(ds, "student");
        strXmlData = ds.GetXml();
        Response.Write("<pre>" + Server.HtmlEncode(strXmlData) + "</pre>");
        ds.WriteXml("myxml.xml", XmlWriteMode.WriteSchema);
        Response.Write("Saved myxml.xml file.");

    }
}
