Beispiel #1
0
        private Employee FindEmployeeWithUsername(string username)
        {
            SqlCommand command = new SqlCommand("Select Email From empDetails Where username = @username", DataBaseManager.GetConnector());

            command.Parameters.AddWithValue("@username", username);
            SqlDataReader reader = command.ExecuteReader();

            if (reader.Read())
            {
                Employee emp = new Employee {
                    Email = reader["Email"].ToString()
                };
                reader.Close();
                return(emp);
            }
            else
            {
                reader.Close();
                return(null);
            }
        }