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_yheuudiseleht : 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 FROM uudised WHERE kood=@uudisekood", cn); // cm.Parameters.AddWithValue("uudisekood", 2); //praegu uudis nr 2 cm.Parameters.AddWithValue("uudisekood", Request.QueryString["ukood"]); cn.Open(); SqlDataReader lugeja = cm.ExecuteReader(CommandBehavior.CloseConnection); if (lugeja.Read()) { Label1.Text = lugeja.GetString(0); Label2.Text = lugeja.GetString(1); Label3.Text = lugeja.GetDateTime(2).ToString(); } lugeja.Close(); } }