using System; using System.Collections; using System.Configuration; using System.Data; using System.Data.Sql; using System.Data.SqlClient; public partial class haldus_pealkirjaloetelu : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection yhendus = new SqlConnection( ConfigurationManager.ConnectionStrings["yhendus1"].ConnectionString ); SqlCommand kask = new SqlCommand("SELECT pealkiri FROM teated", yhendus); yhendus.Open(); SqlDataReader lugeja = kask.ExecuteReader(CommandBehavior.CloseConnection); string vastus = ""; while (lugeja.Read()) { vastus = vastus + " " + lugeja.GetString(0); } silt1.Text = vastus; } }