King David`s Successor Before Solomon was born, who was to become king? David has other sons so if Solomon had not been born, who would have been the heir? Would it be one of the sons who were killed?
If Solomon had not been born, obviously another son would have become king.  After David sinned with Bathsheba and was told an ingenious parable by the prophet Nathan, David pronounced his own judgement by saying that such a person must pay four times for this crime (2 Sam 12:6).  Thus, David had the following sons die:


The son from Bathsheba's first pregnancy (2 Sam 12:18)
David's eldest son and the one most likely to have succeeded as king, Amnon (2 Sam 13), if David had not decided to appoint Solomon as heir (1 Kings 1:29, 30).
David's next son, Absalom (2 Sam 15-17)
David's next son, Adonijah (1 Kings 1:1-52, 2:13-25)


This is somewhat academic, as David had made it quite clear who was to succeed him (1 Kings 1:29, 30).  It was the reigning kings prerogative to appoint his chosen heir which was often (but not always) the eldest son.  [Note the important example of this where Jacob chose Judah over Reuben as his primary heir, from whom came King David himself.]