private void viewAttendanceToolStripMenuItem_Click(object sender, EventArgs e) { TeacherLogedForm lf = new TeacherLogedForm(); lf.WindowState = FormWindowState.Normal; lf.MdiParent = this; lf.Show(); }
private void login_Click(object sender, EventArgs e) { if (password.Text == confirmpassword.Text) { connection.Open(); SqlCommand readNIC = new SqlCommand( "select * from TeacherDetails where NIC='" + nic.Text + "';", connection ); SqlDataReader read = readNIC.ExecuteReader(); if (read.Read()) { connection.Close(); connection.Open(); SqlCommand readNIC2 = new SqlCommand( "select * from TeacherPassword where NIC='" + nic.Text + "';", connection ); SqlDataReader read2 = readNIC2.ExecuteReader(); if (read2.Read()) { connection.Close(); MessageBox.Show("Already You have an account..."); } else { connection.Close(); connection.Open(); SqlCommand insert = new SqlCommand( "insert into TeacherPassword values('" + nic.Text + "','" + password.Text + "');", connection ); insert.ExecuteNonQuery(); connection.Close(); TeacherLogedForm teach = new TeacherLogedForm(); teach.Visible = true; this.Hide(); } } else { connection.Close(); MessageBox.Show("There is no any Teacher NIC inter by admin......."); } } else { MessageBox.Show("confirm password != password"); } }
private void btnLogin_Click(object sender, EventArgs e) { connection.Open(); SqlCommand check = new SqlCommand( "select * from TeacherPassword where NIC='" + txtnic.Text + "' and Password='******';", connection ); SqlDataReader readcheck = check.ExecuteReader(); if (readcheck.Read()) { connection.Close(); TeacherLogedForm tlf = new TeacherLogedForm(); tlf.Visible = true; this.Hide(); } else { connection.Close(); MessageBox.Show("Check your NIC and Password..."); } }