A new fluorescent sensor, 2-(2-oxo-2-(quinolin-8-ylamino)ethoxy)-N-(pyridine-2-ylmethyl) benzamide (L), composed of a quinoline group as the fluorogenic unit and a pyridin-2-ylmethanamine as the binding unit for metal ions has been synthesized. The sensor shows excellent selectivity and sensitivity with a fluorescence enhancement to Zn(2+) over other cations in acetonitrile aqueous solution. The X-ray crystal structure analysis reveals that sensor L coordinates to Zn(2+)via a 1 : 1 binding mode but to Cd(2+)via a 2 : 1 binding mode, which lead to a different spatial arrangement of the fluorogenic unit in these complexes. In addition, density functional theory calculations on L, and the Zn(2+)/L and Cd(2+)/L complexes also imply that the different structures of L significantly affect the molecular orbital energy levels and electron transition, which would result in the spectral changes to distinguish Zn(2+) from Cd(2+). The absorption study results may also suggest the Cd(2+) in the complex can be displaced by Zn(2+). Furthermore, the fluorescence imaging of Zn(2+) in living cells was obtained.