SOQL Scenario-1

Fetch the Name Fields from Account Object

public class SoqlQuery1 {
    public List<Account> acc{set;get;}
    public SoqlQuery1(){
        acc=[select id, name from Account];
    }
}

<apex:page controller="SoqlQuery1" >
    <apex:form >
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:pageBlockTable value="{!acc}" var="a">
                    <apex:column headerValue="Name" value="{!a.name}" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Comments

Popular posts from this blog

Page Layouts