Esempio n. 1
0
        private void Back_Click(object sender, EventArgs e)
        {
            GridForm fm = new GridForm();

            fm.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            GridForm FORM1 = new GridForm();

            FORM1.Show();
            this.Close();
        }
Esempio n. 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (username.Text == " " || password.Text == " ")
            {
                MessageBox.Show("Please provide UserName and Password");
                return;
            }
            try
            {
                Connection conn = new Connection();
                SqlCommand cmd  = new SqlCommand("Select * from dbo.Login where UserName=@username and Password=@password", conn.openConnection());

                cmd.Parameters.AddWithValue("@username", username.Text);
                cmd.Parameters.AddWithValue("@password", password.Text);

                SqlDataAdapter adapt = new SqlDataAdapter(cmd);
                DataSet        ds    = new DataSet();
                adapt.Fill(ds);
                conn.closeConnection();
                int count = ds.Tables[0].Rows.Count;
                //If count is equal to 1, than show frmMain form
                if (count == 1)
                {
                    MessageBox.Show("Login Successful!");
                    this.Hide();
                    //Form1 fm = new Form1();
                    GridForm fm = new GridForm();
                    fm.Show();
                }
                else
                {
                    MessageBox.Show("Login Failed!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void EditStudent_Click(object sender, EventArgs e)
        {
            GridForm form1 = new GridForm();

            form1.Show();
        }