Example #1
0
        public void login()
        {
            SqlConnection  con = new SqlConnection("Data Source=.; Database=school; Integrated Security=SSPI;");
            SqlDataAdapter da;
            DataSet        ds = new System.Data.DataSet();
            string         query;

            if (rb_admin.Checked == true)
            {
                query = "select * from user_details where username='******' and password='******' and usertype='Admin'";
                da    = new SqlDataAdapter(query, con);
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Admin _admin = new Admin();
                    _admin.Show();
                    //this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Username and Password...");
                }
            }
            else
            {
                query = "select * from user_details where username='******' and password='******' and usertype='Teacher'";
                da    = new SqlDataAdapter(query, con);
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Teachers _teacher = new Teachers();
                    _teacher.Show();
                    //this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid Username and Password...");
                }
            }
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            Teachers _teacher = new Teachers();

            _teacher.Show();
        }