【发布时间】:2021-03-25 15:25:41
【问题描述】:
我想将数据库中的结果添加到列表中。但是有一个错误。
String str = '\'AOC\',\'BPD\',\'CRE\'';
List<String> lstString = str.split(',');
List<Shop_Product__c> productList = new List<Shop_Product__c>();
Integer i = 0;
for (String record: lstString) {
System.debug('record[' + i + ']: ' + record);
if ((record != null) && (productList != null)) {
productList.add([SELECT Id, Brand__c
FROM Shop_Product__c
WHERE Brand__c = :record
LIMIT 10]);
System.debug('productList[' + i + ']: ' + productList);
System.debug('Here in for ----------------------------------------');
}
++i;
}
错误是 System.QueryException: List 没有分配给 SObject 的行。 Here是解释,但我不明白我该怎么做。
【问题讨论】:
标签: salesforce apex soql