Yes. Solomon had a census (like his father David's) and God didn't mind at all.
And Solomon numbered all the strangers that were in the land of Israel, after the numbering wherewith David his father had numbered them....
2 Chronicles 2:17
No. God killed 70,000 men because of David's census.
And again the anger of the LORD was kindled against Israel, and he moved David against them to say, Go, number Israel and Judah. ...
And David's heart smote him after that he had numbered the people. And David said unto the LORD, I have sinned greatly in that I have done. ...
So the LORD sent a pestilence upon Israel ... and there died of the people ... seventy thousand men. 2 Samuel 24:1-17
And David said to Joab and to the rulers of the people, Go, number Israel from Beersheba even to Dan; and bring the number of them to
me, that I may know it. ... And God was displeased with this thing; therefore he smote Israel. ... So the LORD sent pestilence upon Israel:
and there fell of Israel seventy thousand men. 1 Chronicles 21:2