In my table I have 5 fields,In those fields,Those are
1.questionId
2.questionUserId
3.SurveyId
4.answer
5.answerId
while I was saving records,I am passing "answer" field and "survey" field as a parameter to my action method. My answer parameter is in the form of string separated my semicolumn.I am splitting this one using "semicolumn" and by executing the for loop I am trying to save values into the database.
How I have to save is that,For adding new record,In the for loop all record values are same except "answer" and "answerId" which is auto incrementing. while I am saving,For the first time of execution new record is saving but for next iteration,It is throwing DuplicateKeyUnhandledByUserCode and Instance of 'DataModel.question_answer' with identity '1850137295-2-1-2-11' already exists in the cache of the object scope.