You need to sign in to do that
Don't have an account?
Yashh
Error: Compile Error: Found punctuation symbol or operator '%' that isn't valid in Apex. at line 6 column 87
Error: Compile Error: Found punctuation symbol or operator '%' that isn't valid in Apex. at line 6 column 87
Apex Code
public class searchBox {
public list <Account> acc {get;set;}
public String searchKey {get;set;}
public searchBox( ) {}
public void search(){
string searchquery='select Name,id from account where name like \ +searchKey+'%\'';
acc= Database.query(searchquery);
}
}
This My VF CODE
<apex:page Controller="searchBox">
<apex:form >
<apex:inputText value="{!searchKey}" label="Input"/><br/>
<apex:commandButton value="Enter" action="{!search}"/>
<apex:pageBlock title="Searched Accounts are:-">
<apex:pageBlockTable value="{!acc}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Code
public class searchBox {
public list <Account> acc {get;set;}
public String searchKey {get;set;}
public searchBox( ) {}
public void search(){
string searchquery='select Name,id from account where name like \ +searchKey+'%\'';
acc= Database.query(searchquery);
}
}
This My VF CODE
<apex:page Controller="searchBox">
<apex:form >
<apex:inputText value="{!searchKey}" label="Input"/><br/>
<apex:commandButton value="Enter" action="{!search}"/>
<apex:pageBlock title="Searched Accounts are:-">
<apex:pageBlockTable value="{!acc}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!
All Answers
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!