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_sqlvaljastus : 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 FROM uudised", cn); cn.Open(); SqlDataReader lugeja = cm.ExecuteReader(CommandBehavior.CloseConnection); while (lugeja.Read()) { Response.Write("pealkiri: " + lugeja.GetString(0)); Response.Write("sisu: " + lugeja.GetString(1)+"
"); } Response.End(); //Koosta eraldi faili uudistest xml-loetelu } }