private void btnVoltar_Click(object sender, EventArgs e) { Hide(); Home2 home = new Home2(); //formMontarAgendaEvento.MdiParent = this; //formMontarAgendaEvento.ControlBox = false; home.StartPosition = FormStartPosition.CenterScreen; home.ShowDialog(); }
private void Loginbutton_Click(object sender, EventArgs e) { connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "Select * From customers where Username ='******' and Password = '******' "; OleDbDataReader reader = command.ExecuteReader(); int count = 0; while (reader.Read()) { count++; } if (count == 1) { MessageBox.Show("Username And Password is Correct"); Home2 second = new Home2(); second.Show(); this.Hide(); } else if (count > 1) { MessageBox.Show("Not Accepted more than one"); } else { MessageBox.Show("Username and Password is not correct"); } connection.Close(); }