The design and synthesis of metal-organic frameworks (MOFs) have attracted much interest due to the intriguing diversity of their architectures and topologies. However, building MOFs with different topological structures from the same ligand is still a challenge. Using 3-nitro-4-(pyridin-4-yl)benzoic acid (HL) as a new ligand, three novel MOFs, namely poly[[(N,N-dimethylformamide-κO)bis[μ2-3-nitro-4-(pyridin-4-yl)benzoato-κ3O,O':N]cadmium(II)] N,N-dimethylformamide monosolvate methanol monosolvate], {[Cd(C12H7N2O4)2(C3H7NO)]·C3H7NO·CH3OH}n, (1), poly[[(μ2-acetato-κ2O:O')[μ3-3-nitro-4-(pyridin-4-yl)benzoato-κ3O:O':N]bis[μ3-3-nitro-4-(pyridin-4-yl)benzoato-κ4O,O':O':N]dicadmium(II)] N,N-dimethylacetamide disolvate monohydrate], {[Cd2(C12H7N2O4)3(CH3CO2)]·2C4H9NO·H2O}n, (2), and catena-poly[[[diaquanickel(II)]-bis[μ2-3-nitro-4-(pyridin-4-yl)benzoato-κ2O:N]] N,N-dimethylacetamide disolvate], {[Ni(C12H7N2O4)2(H2O)2]·2C4H9NO}n, (3), have been prepared. Single-crystal structure analysis shows that the CdII atom in MOF (1) has a distorted pentagonal bipyramidal [CdN2O5] coordination geometry. The [CdN2O5] units as 4-connected nodes are interconnected by L- ligands to form a fourfold interpenetrating three-dimensional (3D) framework with a dia topology. In MOF (2), there are two crystallographically different CdII ions showing a distorted pentagonal bipyramidal [CdNO6] and a distorted octahedral [CdN2O4] coordination geometry, respectively. Two CdII ions are connected by three carboxylate groups to form a binuclear [Cd2(COO)3] cluster. Each binuclear cluster as a 6-connected node is further linked by acetate groups and L- ligands to produce a non-interpenetrating 3D framework with a pcu topology. MOF (3) contains two crystallographically distinct NiII ions on special positions. Each NiII ion adopts an elongated octahedral [NiN2O4] geometry. Each NiII ion as a 4-connected node is linked by L- ligands to generate a two-dimensional network with an sql topology, which is further stabilized by two types of intermolecular OW-HW...O hydrogen bonds to form a 3D supramolecular framework. MOFs (1)-(3) were also characterized by powder X-ray diffraction, IR spectroscopy and thermogravimetic analysis. Furthermore, the solid-state photoluminescence of HL and MOFs (1) and (2) have been investigated. The photoluminescence of MOFs (1) and (2) are enhanced and red-shifted with respect to free HL. The gas adsorption investigation of MOF (2) indicates a good separation selectivity (71) of CO2/N2 at 273 K (i.e. the amount of CO2 adsorption is 71 times higher than N2 at the same pressure).