protected void Page_Load(object sender, EventArgs e) { //View score connection.Open(); MySqlCommand cmd = new MySqlCommand("SELECT userid,score FROM scores"); MySqlDataAdapter adapter = new MySqlDataAdapter(); cmd.Connection = connection; adapter.SelectCommand = cmd; DataTable dt = new DataTable(); adapter.Fill(dt); GridScores.DataSource = dt; GridScores.DataBind(); if (GridScores.Rows.Count > 0) { } else { Response.Write("<script>alert('Error loading data');</script>"); } //Show commnets Show(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["USERNAME"] != null) { lblSuccess.Text = "Welcome, " + Session["USERNAME"].ToString() + ""; } else { Response.Redirect("~/LoginPage.aspx"); } //View score connection.Open(); MySqlCommand cmd = new MySqlCommand("SELECT userid,score FROM scores"); MySqlDataAdapter adapter = new MySqlDataAdapter(); cmd.Connection = connection; adapter.SelectCommand = cmd; DataTable dt = new DataTable(); adapter.Fill(dt); GridScores.DataSource = dt; GridScores.DataBind(); if (GridScores.Rows.Count > 0) { } else { Response.Write("<script>alert('Error loading data');</script>"); } //Show commnets Show(); }