private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.Hide(); WheelForm wf = new WheelForm(MyVal); wf.ShowDialog(); }
private void button22_Click(object sender, EventArgs e) { WheelForm wf = new WheelForm(MyVal); this.Hide(); wf.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { MySqlConnection sqlcon = new MySqlConnection(@"server=localhost;user id=root;database=seproject;password=rootpassword"); MySqlCommand cmd = null; MySqlDataReader reader = null; try { string sql = "SELECT inGameCurrency FROM seproject.user WHERE username = '******';"; //sqlcon = new MySqlConnection(Properties.Settings.Default.ConnectionString); cmd = new MySqlCommand(sql, sqlcon); sqlcon.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { val1 = reader.GetInt32("inGameCurrency"); //lblContinent.Text = reader.GetInt32("continent"); //lblRegion.Text = reader.GetString("region"); //lblSurfaceArea.Text = string.Format("{0:0.00}", reader.GetFloat("surfacearea")); } Console.WriteLine(val1); } catch (Exception ex) { MessageBox.Show(string.Format("An error occurred {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (reader != null) { reader.Close(); } if (sqlcon != null) { sqlcon.Close(); } } try { string sql = "SELECT realCurrency FROM seproject.user WHERE username = '******';"; //sqlcon = new MySqlConnection(Properties.Settings.Default.ConnectionString); cmd = new MySqlCommand(sql, sqlcon); sqlcon.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { val2 = reader.GetInt32("realCurrency"); //lblContinent.Text = reader.GetInt32("continent"); //lblRegion.Text = reader.GetString("region"); //lblSurfaceArea.Text = string.Format("{0:0.00}", reader.GetFloat("surfacearea")); } Console.WriteLine(val2); } catch (Exception ex) { MessageBox.Show(string.Format("An error occurred {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (reader != null) { reader.Close(); } if (sqlcon != null) { sqlcon.Close(); } } MessageBox.Show("Your coins: " + coins.ToString()); sum1 = val1 + coins; sum2 = val2 + tokens; try { sqlcon.Open(); string Query1 = "update seproject.user set inGameCurrency = " + "'" + coins + "' where (username = '******');"; MySqlCommand cmdInsert = new MySqlCommand(Query1, sqlcon); MySqlDataReader reader1 = cmdInsert.ExecuteReader(); MessageBox.Show("Saved"); while (reader1.Read()) { } //sqlcon.Close(); } catch (Exception ex) { MessageBox.Show("Insertion failed"); } finally { sqlcon.Close(); } MessageBox.Show("Your tokens: " + tokens.ToString()); try { sqlcon.Open(); string Query2 = "update seproject.user set realCurrency = " + "'" + tokens + "' where (username = '******');"; MySqlCommand cmdInsert1 = new MySqlCommand(Query2, sqlcon); MySqlDataReader reader2 = cmdInsert1.ExecuteReader(); MessageBox.Show("Saved"); while (reader2.Read()) { } sqlcon.Close(); } catch (Exception ex) { MessageBox.Show("Insertion failed"); } finally { sqlcon.Close(); } this.Hide(); WheelForm wf = new WheelForm(MyVal); wf.ShowDialog(); }