Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CreateNewPass createNewPass = new CreateNewPass(Username);

            createNewPass.ShowDialog();
            this.Close();
            DashBoard dashBoard = new DashBoard(Username);

            dashBoard.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text.ToString();
            string password = textBox2.Text.ToString();
            string check    = textBox3.Text.ToString();

            if (password.Equals(check) && !username.Equals(""))
            {
                MySqlConnection conn = new MySqlConnection(connStr);
                try
                {
                    conn.Open();

                    string          sql    = "CREATE TABLE paswman." + username + " ( `ID` INT NOT NULL AUTO_INCREMENT, `NAME` TEXT NOT NULL , `PASSWORD` TEXT NOT NULL , PRIMARY KEY(`ID`)) ENGINE = InnoDB";
                    MySqlCommand    cmd    = new MySqlCommand(sql, conn);
                    MySqlDataReader result = cmd.ExecuteReader();
                    if (result != null)
                    {
                        while (result.Read())
                        {
                            ;
                        }
                        //this.Close();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                conn.Close();

                try
                {
                    conn.Open();
                    string          sql2    = "INSERT INTO users (`ID`, `NAME`, `PASSWORD`) VALUES (NULL, '" + username + "', '" + password + "')";
                    MySqlCommand    cmd2    = new MySqlCommand(sql2, conn);
                    MySqlDataReader result2 = cmd2.ExecuteReader();
                    if (result2 != null)
                    {
                        while (result2.Read())
                        {
                            ;
                        }
                        DashBoard dash = new DashBoard(username);
                        dash.Show();
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }