- System.QueryException: List has no rows for assignment to SObject
Player__c player = [SELECT Id from Player__c where Name = :username];
if (player != null)
p = player.Id;
这个问题是由于没有Record返回时造成的,解决方案如下:
List<Player__c> players = [SELECT Id from Player__c where Name = :username];
if (players.size() > 0)
p = players.get(0).Id;
2.Your attempt to delete could not be completed because it is associated with the following relationships with other objects.
这个问题是由于在 Object 上删除了 Lookup 的 field之后,需要在进一步的操作才可以完全删除,解决方案如下:
Try going into the object where you deleted the lookup field, and you will see "Deleted Fields". Click that to then fully ERASE the field. You should be able to delete the previously related objects.
网友评论