예제 #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            User_Profile user_Profile = new User_Profile(name, uid);

            user_Profile.Show();
            this.Hide();
        }
예제 #2
0
        private void Login_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "admin" && textBox2.Text == "admin")
            {
                //this.Close();
                Index index = new Index();
                index.Show();
            }
            else
            {
                SqlConnection connection = new SqlConnection(@"Data Source=LAPTOP-FC8BFOQ9\SQLEXPRESS; Database=OnlineGameStore; Integrated Security=SSPI;");

                String     query   = "Select user_id from Account where username = '******' and password = '******';";
                SqlCommand command = new SqlCommand(query, connection);

                connection.Open();
                SqlDataReader reader = command.ExecuteReader();

                String uid = "";

                while (reader.Read())
                {
                    uid = reader[0].ToString();
                }

                if (uid.Length > 0)
                {
                    //user_Games = new User_Games(textBox1.Text, uid);
                    user_Profile = new User_Profile(textBox1.Text, uid);
                    user_Profile.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Username or Password is invalid!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                reader.Close();
                command.Dispose();
                connection.Close();
            }
        }