protected void Page_Load(object sender, EventArgs e)
        {
            PeliId = (Int32)this.Session["peliid"];

            current_username = Context.User.Identity.Name;

            TilausTietokanta til = new TilausTietokanta();

            string connStr = WebConfigurationManager.ConnectionStrings["PelimaailmaConnectionString"]
                             .ConnectionString;
            SqlConnection conn     = new SqlConnection(connStr);
            string        sqlQuery = "SELECT PeliId, Nimi, Vuosi, Alusta, Hinta FROM Pelit WHERE PeliId = @PeliId";
            SqlCommand    sqlCmd   = new SqlCommand(sqlQuery, conn);

            sqlCmd.Parameters.AddWithValue("@PeliId", PeliId);

            try
            {
                conn.Open();
                SqlDataReader reader = sqlCmd.ExecuteReader();
                FormView1.DataSource = reader;
                FormView1.DataBind();
                reader.Close();
            }
            catch (SqlException ex)
            {
                throw new ApplicationException(
                          "Error: Unable to connect to the database!");
            }
            finally
            {
                conn.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            TuoteID       = (Int32)this.Session["tuoteid"];
            Nimi          = (string)this.Session["nimi"];
            Hinta         = (double)this.Session["hinta"];
            Veroprosentti = (double)this.Session["veroprosentti"];
            Kategoria     = (string)this.Session["kategoria"];

            current_username = Context.User.Identity.Name;

            TilausTietokanta til = new TilausTietokanta();

            String        connStr  = WebConfigurationManager.ConnectionStrings["KonekauppaConnectionString"].ConnectionString;
            SqlConnection conn     = new SqlConnection(connStr);
            String        sqlQuery = "SELECT t.TuoteID, t.Nimi, t.Hinta, t.Veroprosentti, k.KategoriaNimi as Kategoria FROM Tuote t JOIN Kategoria k ON k.KategoriaID = t.KategoriaID WHERE TuoteID = @TuoteID";
            SqlCommand    sqlCmd   = new SqlCommand(sqlQuery, conn);

            sqlCmd.Parameters.AddWithValue("@TuoteID", TuoteID);

            try
            {
                conn.Open();
                SqlDataReader reader = sqlCmd.ExecuteReader();
                FormView1.DataSource = reader;
                FormView1.DataBind();
                reader.Close();
            }
            catch (SqlException ex)
            {
                throw new ApplicationException("Error: Unable create database connection!");
            }
            finally
            {
                conn.Close();
            }
        }