read the two chapters in their entirety. In I Samuel l6 Saul is suffering neuralgia from that evil spirit qua god so he wants some music. He is told of a son of Jesse and the kid is sent for with his harp. He is a hit and plays for Saul and sometimes gets things thrown at him. In I Samuel l7 David is running back and forth between court and sheep. Then the giant comes to the kingdom. David volunteers and he and Saul have a lengthy discussion in the middle of l7 as he helps David gird his loins. Then, amazingly after the giant is slain, Saul has an attack of alzheimers. He has no idea who the kid is who just slew the giant. David comes with the head dripping in his hand and is "introduced" to Saul who has no idea whose son he is or who he is.
Explain the contradiction for me.
From the context of Saul in his court at peace, the scene changes to a war with the Philistines in chapter 17. With Saul in the field, David was rendered redundant at court. We observe in 1 Samuel 17:15 that David commuted between his two jobs as minstrel and shepherd. Thus David is home in v17 where he is pressed into service as a courier.
In 17:20-30 David arrives at the battlefield and learns of Goliath, objects to the disrespect and gets in trouble with his older brother. In v31, Saul catches word that someone in camp is acting bravely and sends for him. David volunteers to fight Goliath in v32. They discuss David's fitness to fight in v33-37. David's mission is approved in v38.
In v38-40 David tries Saul's recommended armor and weaponry and opts instead for his own and goes into battle. In v41-51 David triumphs over Goliath. In v52-54 Israel enjoys a military victory.
The apparent contradiction in scriptures is in v55-56 where Saul inquires as to David's father's identity and Saul's general Abner does not know. David returns and the general brings David to Saul in v57. Saul repeats his question of David's father's identity & David answers in v58.
In this case, the bible states that Saul asked a question of David's parenthood in the face of his already been present at Saul's court previously.
The first putative solution is that Saul had the answer in mind when he asked it. His purpose would have been to establish the identity of the hero without any question. By having David return from the fight with Goliath's head in hand and say who he was would preclude anyone else later trying to claim credit for the deed.
The second putative solution is that Saul did not associate this warrior in the field of battle with the minstrel who played the harp for him in court. David's attire at court would probably be different than his attire at a battlefield. It is also possible that Saul never knew the name of the minstrel even if he did associate warrior and minstel as the same man.
If this seems implausible, consider the recent testimony of Monica Lewinski who says that the President did not know her name despite having received sexual favors from her multiple times. National leaders will not necessarily know the names of everyone who works for them. Moreover, they may not retain the name of someone mentioned when distracted by the press of business.
The third putative solution is that Saul was suffering from mental illness at this time and though I have no reason to think he was suffering from Altzheimers as you suggest, his wits may have been addled enough to fail to recall David's father's name.
It should be noted that this is a problem of explaining the behaviour Saul, of a person afflicted with some mental disease. The bible need only give an accurate account of that person's behaviour to be inerrant, it does not have to explain that behaviour, nor must it depict the character's behaviour as consistent or rational, particularly if that was not the case.