I have a table EmployeeRank1 in SQL Server that has a column Name. Under column Name there are two pre-defined names of employees. Moreover, in the table there is a column Password, which contains a generic password, which is "123456".
In WPF I have a textbox and that asks for name and one password box that asks for password. Underneath them, there is a button that says "Login".
The questions is how do I compare the content of Name and Pasword in my table to the input in the text box and the password box?
If the Name entered exists and the Password is correct, a new WPF page will be opened. Otherwise, a message stating that either the name or the password is incorrect will be printed.
This is what I have until now:
// check if the input matches and open the new WPF Page
    private void EmployeeRank1Button_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            // create a query and select everything from the EmployeeRank1 table
            string query = "select * from EmployeeRank1";
            // create a connection to the database and run the query
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(query, sqlConnection);
            // use the sqlDataAdapter
            using(sqlDataAdapter)
            {
                // create a new DataTable that allows us
                // to store data from tables within objects
                DataTable employeeRank1Table = new DataTable();
                // fill the sqlDataAdapter with all the
                // information from the query(from the employeeRank1Table)
                sqlDataAdapter.Fill(employeeRank1Table);
                // TODO: compare Name and Password entered in the TextBox and PasswordBox to the data in the table
                if (tbName.Text == *Name in Table* && pbPassword.Password == *Password in Table*)
                {
                    EmployeeRank1 employeeRank1 = new EmployeeRank1();
                    employeeRank1.Show();
                }
            }
        }
        catch(Exception exception)
        {
            MessageBox.Show(exception.ToString());
        }  
    }
 
     
    