public void inserirFoto(Foto foto) { using (OdbcConnection conexao = ConexaoPadrao.createConnection()) { string sql = "insert into FOTO (ID_ANIMAL, FOTO) values(?,?)"; OdbcCommand command = new OdbcCommand(sql, conexao); command.Parameters.AddWithValue("@ID_ANIMAL", foto.idAnimal); command.Parameters.AddWithValue("@FOTO", foto.foto); conexao.Open(); command.ExecuteNonQuery(); } }
public void alteraFoto(Foto foto) { using (OdbcConnection conexao = ConexaoPadrao.createConnection()) { string sql = "update FOTO set ID_ANIMAL = ?, FOTO = ? where ID_FOTO = ?"; OdbcCommand command = new OdbcCommand(sql, conexao); command.Parameters.AddWithValue("@ID_ANIMAL", foto.idAnimal); command.Parameters.AddWithValue("@FOTO", foto.foto); command.Parameters.AddWithValue("@ID_FOTO", foto.id); conexao.Open(); command.ExecuteNonQuery(); } }