Exemple #1
0
        public bool ObterNota2()
        {
            try
            {
                //CRIANDO CONEXÃO
                string connectionString = "Server=localhost; port=3306; Database=db_escola; User ID=root;";


                MySqlConnection connection = new MySqlConnection(connectionString);

                //ABRIR CONEXÃO
                connection.Open();

                MySqlCommand comando = connection.CreateCommand();
                string       select  = "SELECT * FROM nota WHERE idMateria='" + NomeMateria + "' and idAluno='" + NomeAluno + "';";

                comando.CommandText = select;

                MySqlDataReader reader = comando.ExecuteReader();

                if (reader.HasRows)
                {
                    Turma turma = new Turma();
                    reader.Read();
                    IdNota      = Convert.ToInt32(reader["idNota"]);
                    nomeAluno   = reader["idAluno"].ToString();
                    NomeMateria = reader["idMateria"].ToString();
                    nota        = Convert.ToInt32(reader["nota"]);
                    return(true);
                }
                return(false);

                //TRATAMENTO DO ERRO
                //TENTA EXECUTAR UMA SEQUÊNCIA DE CÓDIGO
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
 public Professor()
 {
     turma = new Turma();
 }
Exemple #3
0
 public Aluno()
 {
     turma = new Turma();
 }