using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql; using System.Data.SqlClient; using System.Configuration; using System.Data; public partial class xmlproov_varundus : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection cn = new SqlConnection(ConfigurationManager. ConnectionStrings["korvpallConnectionString1"].ConnectionString); SqlCommand cm = new SqlCommand( "SELECT pealkiri, uudis, aegumisaeg, aktiivne FROM uudised "+ "FOR XML RAW('uudiserida'), ROOT('uudised'), ELEMENTS ", cn); cn.Open(); string vastus = cm.ExecuteScalar().ToString(); Response.AddHeader("Content-disposition", "attachment;filename=uudistekoopia.xml"); Response.ContentType = "text/xml"; Response.Write(""); Response.Write(vastus); Response.End(); } }