private void addStudentToolStripMenuItem_Click(object sender, EventArgs e) { Student_Info st = new Student_Info(); st.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { string username = txtusername.Text; string password = txtpassword.Text; if (username == "") { errorProvider1.SetError(txtusername, "Name is Missing"); } else if (password == "") { errorProvider1.SetError(txtpassword, "Password is Missing"); } //else if(username=="1" && password == "osama") // { // Student_Info mf = new Student_Info(); // mf.Show(); // MessageBox.Show("You Login In Successfully"); // } string query = "Select * from LoginDB where username ='******'and Password='******'"; SqlDataAdapter da = new SqlDataAdapter(query, conn); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 1) { Student_Info st = new Student_Info(); st.Show(); this.Hide(); } //SqlDataAdapter da =new SqlDataAdapter("Select count(*) FROM LoginForm Where Username='******',Password='******'",conn); //DataTable dt = new DataTable(); //da.Fill(dt); //if (dt.Rows[0][0].ToString() =="1") //{ // this.Hide(); // Student_Info mf = new Student_Info(); // mf.Show(); // MessageBox.Show("You Login SuccessFully"); //} else { MessageBox.Show("Invalid Username & Password"); } //conn.Open(); //string query = "Select * FROM LoginForm"; //SqlDataAdapter da = new SqlDataAdapter(query, conn); //DataTable dt = new DataTable(); //da.Fill(dt); //conn.Close(); }