0
Global class BatchClas1 Implements database.Batchable <Sobject> {
    Global Database.QueryLocator Start (Database.BatchableContext bcontext) {
        String Searching = 'Select Name , Id , Student_name__c From Student__c where Stream_Opted__c = \'Data\' ';

    **return Database.getQueryLocator(Searching);**
    }

    Global Void Execute (Database.BatchableContext bcontext, List<SObject> RecordstoPerform) {
        If (!RecordstoPerform.isEmpty()) {
            List<Student__c> StudentDelete = (List<Student__c>)RecordstoPerform;
            **Database.DeleteResult [] Results = Database.delete (StudentDelete ,False);**
        }
    }
    
    Global Void Finish (Database.BatchableContext bcontext) {
        System.debug('Operation Completed');
        AsyncApexJob J = [Select id,Status,TotalJobItems From AsyncApexJob where Id = :bcontext.getJobId()];
        System.Debug (bcontext.getChildJobId());
    }
}
3
  • 6
    Any chance you have a class named Database in your codebase? If so, my advise would be rename it
    – kurunve
    Commented Apr 4, 2022 at 14:03
  • 4
    Welcome to Salesforce Stack Exchange (SFSE)! Please edit your question to add the exact, full, copied/pasted error message(s). Please do not just give your summary of the error(s).
    – Moonpie
    Commented Apr 4, 2022 at 14:07
  • Thank you , I had a Class Named Database, So this Code Refereed to the Methods of the class that I Created Rather than the Standard one!! Commented Apr 4, 2022 at 14:10

0

You must log in to answer this question.

Browse other questions tagged .