You need to sign in to do that
Don't have an account?
Compile Error: Illegal assignment from LIST:SOBJECT:Contact to LIST:contact
Illegal assignment from a Contact List to a contact list.....hmmmmm. Seems the compiler is having issues with case sensitivity.
This only happens in Summer08. Here is the code to reproduce:
This only happens in Summer08. Here is the code to reproduce:
Code:
List<Contact> cons = new List<Contact>(); cons = [select Id, Name from Contact limit 10];
Message Edited by TehNrd on 06-04-2008 11:09 AM
Message Edited by TehNrd on 06-04-2008 11:21 AM
It was the original issue SimonF mentioned. I never deleted the original contact class I created.
A word to the wise. Don't accidentally create classes with the same name as sObjects.
Message Edited by TehNrd on 06-04-2008 11:49 AM
NOT ABLE TO SORT BASED ON COLOUMNS.GETTING ERROR AT DATABASE.QUERY()
//Our collection of the class/wrapper objects cContact public List contactList {get; set;} //This method uses a simple SOQL query to return a List of Contacts public List getContacts(){ if(contactList == null){ contactList = new List(); for(Contact c : [Select Title,Account.RecordType.Name,Account.Name, AccountId,Name,Id,Email,Phone,mailingstreet,mailingcity,mailingstate,mailingcountry from Contact]) { contactList.add(new cContact(c)); } } return contactList; } public string sortfield1{get;set;} public void doconssort() { List ct2; List sortcons=new List(); if(contactlist.size()>0) { for(integer i=contactlist.size();i>0;i--) { sortcons.add(contactlist[i-1]); } contactlist.clear(); contactlist.addAll(sortcons); ct2=database.query(contactlist + ‘ order by ‘ + ‘ + sortfield1 + ‘ ‘ + ‘ limit 20’); } } VF page
had the same error and found that I also had a different class with the same name as the object ..Contact.. Tx guys
Thanks this helped I did this as well!
Thanks for the post ..Yes it is true,I am getting similar error for Opportunity also but what is the reason behind this?
You probably have an Apex class named Opportunity. Apex classes should not have the same name as standard or custom objects.