private void Back_Button_Click(object sender, EventArgs e)
        {
            this.Hide();
            Student_Profile_Form spf = new Student_Profile_Form();

            spf.ShowDialog();
        }
Ejemplo n.º 2
0
        private void Sign_In_Click(object sender, EventArgs e)
        {
            SqlConnection  sqlconn = new SqlConnection(@"Data Source=DESKTOP-R54EQ4I;Initial Catalog=Student_Profile;Integrated Security=True");
            String         queary  = "Select * from Student_Login where Student_ID = '" + text_StudentID.Text.Trim() + "' and Student_Passwrd = '" + text_StudentPassword.Text.Trim() + "'";
            SqlDataAdapter sda     = new SqlDataAdapter(queary, sqlconn);
            DataTable      dt      = new DataTable();

            sda.Fill(dt);

            if (dt.Rows.Count == 1 && text_StudentID.Text.Length > 1 && text_StudentPassword.Text.Length > 1)
            {
                SqlConnection sqlcon = new SqlConnection(@"Data Source=DESKTOP-R54EQ4I;Initial Catalog=Student_Profile;Integrated Security=True");
                sqlcon.Open();
                SqlCommand cmd = new SqlCommand("Update Student_updateloginId set Student_ID = '" + text_StudentID.Text + "'", sqlcon);
                cmd.ExecuteNonQuery();
                sqlcon.Close();

                this.Hide();
                Student_Profile_Form spf = new Student_Profile_Form();
                spf.ShowDialog();
            }
            else
            {
                MessageBox.Show("Wrong ID / Password");
            }
        }