Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Login_Successfully x = new Login_Successfully();

            this.Hide();
            x.Show();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String AdminID   = textBox1.Text;
            String password  = textBox2.Text;
            String AdminPass = "";

            try
            {
                con.Open();
                SqlCommand    com = new SqlCommand(@"SELECT adminPassword from Admin_info where adminID = '" + AdminID + "'", con);
                SqlDataReader DR1 = com.ExecuteReader();
                if (DR1.Read())
                {
                    AdminPass = DR1.GetValue(0).ToString();
                    if (AdminPass == password)
                    {
                        StreamWriter x = new StreamWriter("admin.txt");
                        x.Write(AdminID);
                        x.Close();
                        Login_Successfully obj = new Login_Successfully();
                        this.Hide();
                        obj.Show();
                    }
                    else
                    {
                        label1.Hide();
                        label2.Text = "There is some thing error in the UserName or Password, retry again";
                    }
                }

                con.Close();
            }
            catch
            {
                MessageBox.Show("There is error Somewhere");
            }

            /*
             * StreamReader input = new StreamReader("adminpass.txt");
             * String password = input.ReadLine();
             * input.Close();
             * if(password==textBox2.Text)
             * {
             *  Login_Successfully obj = new Login_Successfully();
             *  this.Hide();
             *  obj.Show();
             * }
             * */
        }