private void Button2_Click(object sender, EventArgs e) { this.Hide(); Home1 hm1 = new Home1(); hm1.Show(); }
private void Button3_Click_1(object sender, EventArgs e) { this.Hide(); Home1 h1 = new Home1(); h1.Show(); }
} //SELECT id_employee FROM employee WHERE employee_number= @txtUserName AND passWord= @txtPassword"; //"select count(*) from data1 where username ='******' and password='******'" , sql private void Button1_Click(object sender, EventArgs e) { SqlConnection sql = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\SHAHID AFRIDI ZIHAD\Documents\data.mdf; Integrated Security = True; Connect Timeout = 30"); SqlDataAdapter sda = new SqlDataAdapter("select type from UserData where username ='******' and password='******'", sql); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { this.Hide(); if (dt.Rows[0][0].ToString() == "Student") { Student s = new Student(); s.Show(); } if (dt.Rows[0][0].ToString() == "Faculty") { faculty f = new faculty(); f.Show(); } if (dt.Rows[0][0].ToString() == "Admin") { Home1 hm = new Home1(); hm.Show(); } } else { MessageBox.Show("Invalid user name or password"); } }