You need to sign in to do that
Don't have an account?
Illegal assignment from LIST<Account> to LIST<Account> at line 9 column 5
When I run the following code i got error like
"controllercls2 Compile Error: Illegal assignment from LIST<Account> to LIST<Account> at line 9 column5"
And
When i insert out side of constructor " lst=[select id,name,phone from Account]; "
I got Error lik this
"Error: controllercls2 Compile Error: unexpected token: '=' at line 11 column 3 "
<apex:page controller="controllercls2" id="page">
<apex:form id="form">
<apex:outputlabel >Enter Text to search</apex:outputlabel>
<apex:inputtext />
<apex:commandButton value="Search" />
<apex:pageblock id="pb">
<apex:pageblocktable value="{!lst}" var="c">
<apex:column value="{!c.name}"/>
<apex:column value="{!c.phone}"/>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>
------------------------------------------
public with sharing class controllercls2 {
public List<Account> lst { get; set; }
public controllercls2()
{
lst=[select id,name,phone from Account];
}
}
Hi Siva,
In your organization somewhere you have created a class named "Account". Thats why the compiler is not able to understand that it is standard Object Account or the class created by you. Please rename your class, it will work.
All Answers
Hi Siva,
In your organization somewhere you have created a class named "Account". Thats why the compiler is not able to understand that it is standard Object Account or the class created by you. Please rename your class, it will work.
That looks like lst doesn't contain Account sobjects. Do you have a custom class named Account?
You also have the option of prefixing references to the account sobject with 'schema', e.g.
(edited as I'd used contact rather than contact in one place).
Thanks bob,
For nice information.
Thanks bob .......
Yes i was used another class name as Account............ Thanks lot . I solve the problem with the help of SCHEMA
yep.....it works
Thank you very much. It works for me...
you are corrct.. I deleted account class from apex classes links.
Its works fine.
thank you.
@bob_buzzard
can you explain Schema.SomeSobject for me.
what does it mean ?
I found alot of your useful answer. thanks for you help .