private void metroButton2_Click_1(object sender, EventArgs e)
        {
            Studentinfo ss = new Studentinfo(id);

            ss.Show();
            this.Hide();
        }
Beispiel #2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            OleDbDataAdapter adap = new OleDbDataAdapter("select * from Student where StdId = " + metroTextBox1.Text + " and Password = "******" ", con);

            adap.Fill(d2, "Student");

            Studentinfo si = new Studentinfo(metroTextBox1.Text);

            si.Show();
            this.Hide();
            //Studentinfo s = new Studentinfo();

            //try
            //{
            //    string constring = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\ASAD\University data\Fifth Semester\Visual Programming\Project\New Project\hostel-2.mdb";
            //    OleDbConnection conDataBase = new OleDbConnection(constring);
            //    OleDbCommand cmdDataBase = new OleDbCommand("Select * from Student where StdId=" + this.metroTextBox1.Text + " and Password="******";", conDataBase);
            //    OleDbDataReader myReader;

            //    conDataBase.Open();
            //    myReader = cmdDataBase.ExecuteReader();
            //    int count = 0;
            //    while (myReader.Read())
            //    {
            //        count = count + 1;
            //    }
            //    if (count == 1)
            //    {
            //        MessageBox.Show("Login Successful");
            //        this.Hide();
            //        //Cafe c = new Cafe();
            //        Studentinfo s = new Studentinfo();
            //        s.Show();
            //    }
            //    else if (count > 1)
            //    {
            //        MessageBox.Show("Duplicate Username or Password");
            //    }
            //    else
            //        MessageBox.Show("Username or Password do not match");

            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }