private void homeLabel_Click(object sender, EventArgs e) { home a = new home(); this.Hide(); a.Show(); }
private void label5_Click(object sender, EventArgs e) { home h = new home(); this.Hide(); h.Show(); }
private void loginButton_Click(object sender, EventArgs e) { using (SqlConnection Connection = dbUtil.GetSqlConnection(dbUtil.GetConnectionString())) { using (SqlCommand sqlCommand = new SqlCommand("SELECT * FROM Users where username='******'and password = '******'", Connection)) { using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand)) { SqlDataReader read = sqlCommand.ExecuteReader(); int c = 0; while (read.Read()) { c++; } if (c > 0) { MessageBox.Show("Login Success"); home h1 = new home(); this.Hide(); h1.Show(); } else { MessageBox.Show("Incorrect login"); userNameTextbox.Text = ""; passwordTexbox.Text = ""; } } } } }