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
sf sharathsf sharath 

Error: input Compile Error: Illegal assignment from LIST<Account> to account

<apex:page controller="input">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:inputField value="{!a.name}"/>
<apex:inputField value="{!a.phone}"/>
<apex:inputField value="{!a.industry}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

 

public class input {
public account a{get;set;}
public input(){
id id1 = ApexPages.currentpage().getParameters().get('id');
if(id1<>null)
{
a= [select id,name,industry,phone from account where id = :id1];
}
else
{
a = new account();
}}
public PageReference save() {
upsert a;
a= new account();
return (new ApexPages.StandardController(a).view());
}
}

bob_buzzardbob_buzzard

This is a duplicate post.  I've posted to the other thread:

 

http://boards.developerforce.com/t5/Apex-Code-Development/please-help-me/m-p/430951#M78195