I have an asp.net application in which I am using linq for data manipulation. While running, I get the exception \"Sequence contains no matching element\".
The First(IEnumerable) method throws an exception if source contains no elements. To instead return a default value when the source sequence is empty, use the FirstOrDefault method.