See I have written a storeprocedure it should something like this I don't know your table name, I just studied your conversation and procedure something like this
create procedure usp_QuestionAnswer
{
@question_id int=0 ,
@student_id int =0,
@answer varchar(500)=null
}
AS BEGIN
if not exists(select question_id from tblQuestionAnswer where question_id = @question_id and student_id =@student_id ) begin
insert into tblQuestionAnswer(question_id ,student_id,answer)
values(@question_id ,@student_id,@answer)
end
END