Q. System.Query Exception: List has no rows for assignment to s-objec.
Ans:
"System.Query Exception: List has no rows for assignment to sobject" comes when we query the Object it has no records to fetched, and we are trying to assign to sobject it will throw this error.So simply use List to avoid it.
Account a = [SELECT Name from Account WHERE Id=: strld];
and an exception was thrown: System.QueryExceptoin: List has no rows for assignment to SObject.
Here is the mistake I made and how to fix it:
List<Account> lst = [SELECT Name from Account WHERE Id=: strld];
and an exception was thrown: System.QueryExceptoin: List has no rows for assignment to SObject.
Here is the mistake I made and how to fix it:
List<Account> lst = [SELECT Name from Account WHERE Id=: strld];