Insert Record using Visualforce Page & Apex Class #inSalesforce

Insert Record using Visualforce Page & Apex Class #inSalesforce


<apex:page controller="CreateAccountClass">
    <apex:form>
        <apex:pageblock>
            <apex:pageblocksection>
                <apex:inputfield value="{!a.Name}"/>
                <apex:inputfield value="{!a.Accountnumber}"/>
            </apex:pageblocksection>
            <apex:commandbutton action="{!SaveMethod}" value="Save"/>
        </apex:pageblock>
    </apex:form>
</apex:page>



public class CreateAccountClass{
    public Account a {get;set;}
    public CreateAccountClass(){        
        a = new Account();
    }
    public PageReference SaveMethod(){
        insert a;
        return null;
    }
}

Comments