using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql; using System.Data.SqlClient; public partial class andmeloetelu : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection yhendus = new SqlConnection( "Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\kasutaja\\jaagup\\andmedxml1\\App_Data\\Database.mdf;Integrated Security=True;User Instance=true"); SqlCommand kask = new SqlCommand( "SELECT id, koeranimi, synniaasta "+ "FROM koerad FOR XML auto, "+ " root('koerteloetelu')", yhendus); yhendus.Open(); String vastus = kask.ExecuteScalar() as String; Response.ContentType = "text/xml"; Response.Write(""); Response.Write(vastus); Response.End(); } }