+ Start a Discussion
Padmanabhan KamuniPadmanabhan Kamuni 

Error Error: Task08 Compile Error: Illegal assignment from List<Account> to Set<Account> at line 8 column 7

public class Task08 {
     public string keyword{get;set;}
     Set<Account> sette=new Set<Account>(); 
      public Task08(){
      
      sette=[SELECT Name FROM Account ];
      }
     public pagereference Search(){
    
        //sette=[SELECT Name, id,Course_Name__c FROM Group__c ];
         return null;
     }
}
Best Answer chosen by Padmanabhan Kamuni
ashishashish
hi,
Query always return 'List' in result, so u have to copy them into Set.
Set<String> name= Set<String>(List);

thanks 

All Answers

Padmanabhan KamuniPadmanabhan Kamuni
Kindly help in this issue. IDK what's wrong with code(code is correct)
ashishashish
hi,
Query always return 'List' in result, so u have to copy them into Set.
Set<String> name= Set<String>(List);

thanks 
This was selected as the best answer
WEN JIEWEN JIE
This soql will return an account list.
"[SELECT Name FROM Account ]"
Padmanabhan KamuniPadmanabhan Kamuni
Thanks Ashish & Wen.. Got it ..