public void showTopTen() { try { DataTable dataT = ConnectioBDD.executeQuery("SELECT a.username, b.score FROM PRO_score b " + "inner join pro_user a on b.id_user = a.id_user order by b.score desc limit 10"); //MessageBox.Show(data.Rows[0][0].ToString()); for (int i = 0; i < dataT.Rows.Count; i++) { var label = new Label(); label.Dock = DockStyle.Fill; label.Text = dataT.Rows[i][0].ToString(); label.TextAlign = ContentAlignment.MiddleCenter; var label2 = new Label(); label2.Dock = DockStyle.Fill; label2.Text = dataT.Rows[i][1].ToString(); label2.TextAlign = ContentAlignment.MiddleCenter; label.BackColor = Color.Transparent; label.Parent = current; label2.BackColor = Color.Transparent; label2.Parent = current; ((VTableView)current).TableLayoutPanel1.Controls.Add(label, 0, i + 1); ((VTableView)current).TableLayoutPanel1.Controls.Add(label2, 1, i + 1); } } catch (Exception e) { //MessageBox.Show("Ocurrio un error en conn a la BD: " + e); } }
public void createUser(String txt) { try { ConnectioBDD.executeNonQuery($"INSERT INTO PRO_USER (USERNAME) VALUES ('{txt}')"); } catch (Exception e) { //MessageBox.Show("Ocurrio un error en conn a la BD: " + e); } }
public void saveScore(int txt) { try { ConnectioBDD.executeNonQuery($"INSERT INTO PRO_SCORE (ID_USER, SCORE) " + $"SELECT ID_USER, '{txt}' FROM PRO_USER WHERE " + $"USERNAME = '******'"); } catch (Exception e) { //MessageBox.Show("Ocurrio un error en conn a la BD: " + e); } }