You need to sign in to do that
Don't have an account?
surekha
About LKE operator
Hi..
Actualy i need the records which are starts with letter 'a' in Account object .
i tried with the below query ,but it shows all the records..once i clock the button..
varacc=[select name from Account WHERE name LIKE 'a%'];
Thanks & Regards
surekha
Your search string is hardcoded to accounts starting with s:
varacc=[select name from Account WHERE name LIKE's%'];
You should change this to something like:
Note that I've built the wildcarded search string outside of the query - I've found that I have to do that to dynamically bind in the string.
All Answers
This works correctly in my dev org - I have one account beginning with 'A' and only that account is retrieved.
What button are you clicking?
Hi..
I'll send the whole program Plz check it..n rly me
VF Page:-
<apex:page controller="DisplayNames">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
Enter Letter:<apex:inputText value="{!value1}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Search" action="{!search}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable Value="{!SecRecords}" var="Show">
<apex:column value="{!Show.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Class:
public with sharing class DisplayNames
{
public String value1 { get; set; }
List<Account> varacc;
public void search()
{
varacc=[select name from Account WHERE name LIKE's%'];
}
public List<Account> getSecRecords()
{
return varacc;
}
}
Thanks & Regards
surekha
Your search string is hardcoded to accounts starting with s:
varacc=[select name from Account WHERE name LIKE's%'];
You should change this to something like:
Note that I've built the wildcarded search string outside of the query - I've found that I have to do that to dynamically bind in the string.
..