public class search {
public search(){
soql = '';
service = new list<Service__c>();
}
public string soql;
public string city{get;set;}
public list<Service__c> service{get;set;}
public void dosearch(){
soql = '';
soql = soql + 'select id,name,Bus_Type__c,From__c from Service__c';
soql = soql + 'Where From__c = ' + '\''+city+'\'';
system.debug('choos=================>' +soql);
service = new list<Service__c>();
service = database.query(soql);// Error hear
}
}
Visualforce
<apex:inputText value="{!city}"/>
<apex:commandButton value="Search" action="{!dosearch}"/> //Error
<apex:pageBlock title="Display Value">
<apex:pageblockTable Value="{!service}" var="v">
<apex:column value="{!v.name}"/>
<apex:column value="{!v.Bus_Type__c}"/>
</apex:pageblockTable>
</apex:pageBlock>