function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Reddy SreeDeviReddy SreeDevi 

public void searchRecord() { soql=''; soql=soql+'select id,First_Name__c,Country__c from Candidate__c'; soql = soql+'where City__c =' + '\''+selectedcity +'\''; lstc =database.query(soql);

    public void searchRecord()
    {
        soql='';
        soql=soql+'select id,First_Name__c,Country__c from Candidate__c';
        soql = soql+'where City__c =' + '\''+selectedcity +'\'';
        lstc =database.query(soql);
}
Visualforce Error
Help for this Page
System.QueryException: unexpected token: =
Error is in expression '{!searchRecord}' in component <apex:commandButton> in page v29searchcandidate: Class.candidatecitysearch.searchRecord: line 19, column 1
Class.candidatecitysearch.searchRecord: line 19, column 1
Raj VakatiRaj Vakati
It's the space issue.  See the code here .
public void searchRecord()
    {
        soql='select id,First_Name__c,Country__c from Candidate__c';
        soql = soql+' where City__c =' + '\''+selectedcity +'\'';
        lstc =database.query(soql);
}

 
Prashant Pandey07Prashant Pandey07
Hi Sree,

Check below code..
 
public void searchRecord(String selectedcity)
    {
        List<Candidate__c>lstc=new List<Candidate__c>();
       String  soql='select id,First_Name__c,Country__c from Candidate__c';
        soql = soql+' where City__c =' + '\''+selectedcity +'\'';
        lstc =database.query(soql);
}

Mark this as the best answer if you are able to solve your problem and help the community grow.
--
Thanks,
Prashant