You need to sign in to do that
Don't have an account?
nobineko
SOQL文を変数に入れて利用する方法
Controller内で、List1にセットするSOQL文を動的に作成したいのですが、どうすればいいでしょうか?
イメージとしては、以下の様にしたいのですが、エラーになってしまいます。
List<Acount> List1 = [Select Name From Acout Where TEL == :stmp];
↓
String sSOQL = ’[Select Name From Acout Where TEL == :stmp]’ ;
List<Acount> List1 = sSOQL;
よろしくお願いします。
こちらでいかがでしょうか?
List<Account> List1 = [Select Name From Account Where TEL = :stmp]’;
Listに直接できます。
SOQL文を動的にするなら、こちらのやり方もあります。
http://www.salesforce.com/us/developer/docs/apexcodepre/index.htm