Using density functional theory, we investigate the adsorption properties of acetylsalicylic acid (aspirin) on the outer surfaces of a (10,0) carbon nanotube (CNT) and a (8,0) triazine-based graphitic carbon nitride nanotube (CNNT). The adsorption energies for the CNNT and CNT are 0.67 and 0.51 eV, respectively, and hence, the aspirin molecule binds more strongly to the CNNT. The stronger adsorption energy for the binding to the CNNT is ascribed to the high reactivity of its nitrogen atoms with high electron affinity. The CNNT exhibits local electric dipole moments that cause strong charge redistribution in the adsorbed aspirin molecule. The influence of an external electric field on the adsorption of aspirin on the nanotubes is explored by examining modifications in their electronic band structures, partial densities of states, and charge distributions. An electric field applied along a particular direction is found to induce molecular states of aspirin that lie within the in-gap region of the CNNT. This implies that the CNNT can be potentially utilized for the detection of aspirin.