private void back_Click(object sender, EventArgs e) { laborIn i = new laborIn(UserName, Password); i.Show(); this.Hide(); }
private void logIn_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(@"Server=.\SQLEXPRESS;Database=labormgt;Integrated Security=true"); conn.Open(); string query = ""; query = "Select * FROM labor WHERE UserName='******' and Password='******' "; SqlDataAdapter ss = new SqlDataAdapter(query, conn); DataTable dtbl = new DataTable(); ss.Fill(dtbl); if (dtbl.Rows.Count == 1) { MessageBox.Show("Successfully LogedIn!!!", "Message"); string Username = textUserName.Text; string Password = textPassword.Text; laborIn i = new laborIn(Username, Password); this.Hide(); i.Show(); } else { MessageBox.Show("Error!!!", "Message"); } conn.Close(); }