Wikipedia says that John Q. Adams was affiliated with the Federalist, Democratic-Republican, National Republican, Anti-Masonic, and Whig parties. Of the Democratic-Republican party, Wikipedia says: "Not to be confused with the current Democratic Party or the Republican Party in the United States, both of which indirectly descend from this party." Of the National Republican party, Wikipedia says: "Not to be confused with Republican Party (United States)".
A) Wikipedia is not a reliable source. B) If the party that he was affiliated with WHILE he was president was not named the "Democrat" or "Republican" party, it doesn't count.