You need to sign in to do that
Don't have an account?
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());
}
}
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