+ Start a Discussion

Error: Compile Error: Illegal assignment from LIST<Account> to LIST<Account> at line 12 column 9

MY Vf Page


    <apex:page controller="SubmitCaseController">

    <h1>Submit New Case</h1>
    <apex:form >
        <apex:pageMessages />
                <th>Your Name:</th>
                <td><apex:inputText value="{!c.SuppliedName}"/></td>
                <th>Your Email:</th>
                <td><apex:inputText value="{!c.SuppliedEmail}"/></td>
                <th>Your Account Number:</th>
                <td><apex:inputText required="true" value="{!acctNum}"/></td>
                <td><apex:inputText required="true" value="{!c.Subject}"/></td>
                <th>Your Problem:</th>
                <td><apex:inputTextArea required="true" rows="5" value="{!c.Description}"/></td>
                <td><apex:commandButton value="Submit Case" action="{!submitCase}"/></td>


Apex Class---->>


 public class SubmitCaseController {
    public Case c { get; set; }
    public String acctNum { get; set; }
    public SubmitCaseController() {
        c = new Case();
    public PageReference submitCase() {
        List<Account> accts = [SELECT Id FROM Account WHERE AccountNumber = :acctNum]; //error occuring point
        if (accts.size() != 1) {
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Invalid account number');
            return null;
        } else {
            try {
                c.AccountId = accts.get(0).Id;
                // now look for an associated contact with the same email
                Contact cnt = [SELECT Id FROM Contact WHERE AccountId = :c.AccountId AND Email = :c.SuppliedEmail LIMIT 1];
                if (cnt != null)
                    c.ContactId = cnt.Id;
                // Specify DML options to ensure the assignment rules are executed
                Database.DMLOptions dmlOpts = new Database.DMLOptions();
                dmlOpts.assignmentRuleHeader.useDefaultRule = true;

                // Insert the case
                INSERT c;
                return new PageReference('/thanks');
            } catch (Exception e) {
                return null;


How can i slove this...??