function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srinivas pulipatisrinivas pulipati 

Hi, i am writing this code in apex,Vf page but code is not execute error came please solve this error?

Apex code:
public class acclist {
    List<account> acc=new List<Account>();
     public void show(){
    for(integer i=1;i<=4000;i++){
        Account a=new Account(name='UserToday',industry='Banking');
        acc.add(a);
    }
    insert acc;
}
}
Vf Code :

<apex:page  controller="acclist" tabStyle="Account">
    <apex:form>
      <apex:pageBlock title="Create acccount">
         <apex:commandButton value="show" action="{!show}"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Error:

System.LimitException: Too many SOQL queries: 101
Error is in expression '{!show}' in component <apex:commandButton> in page acclist: Trigger.AccountInsert: line 3, column 1
Trigger.AccountInsert: line 3, column 1
 
Amit Chaudhary 8Amit Chaudhary 8
Hi Srinivas pulipati

It look like some issue in your trigger. Please post your account trigger code
Himanshu ParasharHimanshu Parashar

Hi Srinivas,

It seems like you have a SOQL inside loop so please post your trigger code.

 

Thanks,
Himanshu