• Raksha Tiwari
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
This is my controller :

public class ContactsListController{

 private string sortOrder = 'LastName';
 
 public List<Contact> getContacts(){
 
  string soqlQuery = 'SELECT Id, FirstName, LastName, Title, Email'+ 'from Contacts'+ 'OrderBy' + sortOrder 
                          + 'ASC' + 'LIMIT 10' ;
  
  List<Contact> results = Database.query(soqlQuery);
  return results;
  
 }                         

}



And this is my visualforce page :

<apex:page controller="ContactsListController" >
  <apex:form >
   <apex:pageBlock title="Contacts List" id="Contacts_list">
   
    <apex:pageBlockTable value="{!Contacts}" var="ct">
    <apex:column value="{!ct.FirstName}"/>
    <apex:column value="{!ct.LastName}"/>
    <apex:column value="{!ct.Title}"/>
    <apex:column value="{!ct.Email}"/>
    
    </apex:pageBlockTable>
  
   </apex:pageBlock>
  </apex:form>
</apex:page>


I'm getting an error "System.QueryException: unexpected token: 10 " while saving the above vf page. Please help.