Esempio n. 1
0
        private void back_Click(object sender, EventArgs e)
        {
            teacherfirstform teacherfirstform = new teacherfirstform();

            this.Hide();
            teacherfirstform.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            teacherfirstform teacherfirstformui = new teacherfirstform();

            teacherfirstformui.Show();
            this.Close();
        }
 private void btnlogin_Click(object sender, EventArgs e)
 {
     if (radiobtnstudent.Checked == true)
     {
         string        connectionstring1 = @"Data Source=TUHIN-PC\SQLEXPRESS;Initial Catalog=university;Integrated Security=True";
         SqlConnection connection        = new SqlConnection(connectionstring1);
         SqlCommand    command           = new SqlCommand("SELECT *FROM studentbasic WHERE name='" + txtname.Text + "'and pass='******'", connection);
         connection.Open();
         SqlDataReader reader;
         reader = command.ExecuteReader();
         int count = 0;
         while (reader.Read())
         {
             count++;
         }
         if (count == 1)
         {
             studentinterface studentinterface = new studentinterface(txtname.Text);
             studentinterface.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Name Or Password Is incorrect", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else if (radiobtnteacher.Checked == true)
     {
         string        connectionstring1 = @"Data Source=TUHIN-PC\SQLEXPRESS;Initial Catalog=university;Integrated Security=True";
         SqlConnection connection        = new SqlConnection(connectionstring1);
         SqlCommand    command           = new SqlCommand("SELECT *FROM teacher WHERE name='" + txtname.Text + "'and pass='******'", connection);
         connection.Open();
         SqlDataReader reader;
         reader = command.ExecuteReader();
         int count = 0;
         while (reader.Read())
         {
             count++;
         }
         if (count == 1)
         {
             teacherfirstform teacherfirstform = new teacherfirstform();
             this.Hide();
             teacherfirstform.Show();
         }
         else
         {
             MessageBox.Show("Name Or Password Is incorrect", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }