Search
Twitter
« Import Your Data into Salesforce | Main | CRM: Asia is Catching Up »
Tuesday
Oct092012

Fix System Query Exception Error

 

What the Heck is This? "System.QueryException: List Has No Rows for Assignment to SObject"

So I was quering 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];

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.