public void Salvar(Model.ClassDiretorFilmes diretor)
 {
     try
     {
         diretor1.Inserir(diretor);
     }
     catch (Exception erro)
     {
         string teste = erro.ToString();
         Console.WriteLine(teste);
     }
 }
示例#2
0
        public void Inserir(Model.ClassDiretorFilmes diretor)
        {
            try
            {
                AbrirConexao();
                comando = new MySqlCommand("INSERT INTO diretor (id, idfilme, nome, cargo) VALUES (@id, @idfilme, @nome, @cargo", conexao);

                comando.Parameters.AddWithValue("id", diretor.Id);
                comando.Parameters.AddWithValue("idfilme", diretor.IdFilme);
                comando.Parameters.AddWithValue("nome", diretor.Nome);
                comando.Parameters.AddWithValue("cargo", diretor.Cargo);

                comando.ExecuteNonQuery();
            }
            catch (Exception erro)
            {
                throw erro;
            }
        }