using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.Sql; using System.Data.SqlClient; public partial class sqlvaljastus1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection cn = new SqlConnection(ConfigurationManager. ConnectionStrings["DatabaseConnectionString1"].ConnectionString); SqlCommand cm = new SqlCommand("SELECT pealkiri, isnull(sisu,'') as sisu FROM teated", cn); cn.Open(); Response.ContentType = "text/plain"; SqlDataReader lugeja = cm.ExecuteReader(CommandBehavior.CloseConnection); while (lugeja.Read()) { //üks rida korraga Response.Write(lugeja.GetString(0) + " - " + lugeja.GetString(1)+"\n"); } Response.End(); } }