XML ASP.Net Tutorial

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"  Inherits="XmlDataSet" %>



    Untitled Page


    
    
      
        
        
    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Xml;
public partial class XmlDataSet : System.Web.UI.Page
{
  protected void cmdDataSetToXml_Click(object sender, EventArgs e)
  {
    string connectionString =
        WebConfigurationManager.ConnectionStrings["Pubs"].ConnectionString;
    string SQL = "SELECT * FROM authors WHERE city='Oakland'";
    SqlConnection con = new SqlConnection(connectionString);
    SqlCommand cmd = new SqlCommand(SQL, con);
    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet("AuthorsDataSet");
    con.Open();
    adapter.Fill(ds, "AuthorsTable");
    con.Close();
    XmlDataDocument dataDoc = new XmlDataDocument(ds);
    XmlControl.XPathNavigator = dataDoc.CreateNavigator();
        XmlControl.TransformSource = "Data.xsl";
  }
}
File: Data.xsl

                version="1.0">

   

The Author List


      
   Created through XML and XSLT


Name: 
Phone:  


File: Web.config