The linker 1,4-bis(2-methyl-imidazole-yl)-butane (bib) was used to construct two coordination polymers, specifically [Cd(bib)(ipa)]n (1) and [Zn(bib)(tpa)]n (2), in the presence of isophthalic acid (H2ipa) and terephthalic acid (H2tpa), respectively, under solvothermal conditions. Topological analyses reveal that the crystal of complex 1 consists of a 3D threefold interpenetrating network with Schlafli symbol {65.8}, while complex 2 possesses a 2D wavelike layer structure with Schlafli symbol {66}. The photocatalytic properties of both complexes for the degradation of methyl violet have been explored, revealing that complex 2 is a better photocatalyst than 1. A mechanism for the photocatalytic properties of the complexes is proposed, based on the results of density of states (DOS) and partial DOS calculations.