Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i try this code and It is giving me the error on the 'where' i verify: using system.linq; and using System.Data.Entity but not fixed(i work with visual studio 2012 ultimate and sql server 2008 r2)

code:
public static int updatecondidate(int condidateID, condidate_table   updatedcondidateData)
{ int rowAffected = 0;

    using (EmployeementSystemEntities DB = new EmployeementSystemEntities())
    {
        //select condidate for update
        condidate_table condidateforupdate = (from anything in DB.condidate_table
                                              where anything.condidate_id == condidateID
                                              select anything).FirstOrDefault();
        condidateforupdate.condidate_name = updatedcondidateData.condidate_name;
        condidateforupdate.condidate_phone = updatedcondidateData.condidate_phone;
        condidateforupdate.condidate_email = updatedcondidateData.condidate_email;
        condidateforupdate.condidate_pic = updatedcondidateData.condidate_pic;
        rowAffected = DB.SaveChanges();
    }
    return rowAffected;
} 


the same error here on "Select"
//select all condidate

public static List<condidate_table> SelectAllCondidate()
{
    using (EmployeementSystemEntities DB = new EmployeementSystemEntities())
    {
        List<condidate_table> AllCondidate = (from anything in DB.condidate_table 
                                              select anything).ToList<condidate_table>();
        return AllCondidate;
    }
} 
Posted
Comments
Sascha Lefèvre 19-Apr-15 20:24pm    
Is DB.condidate_table actually a property/field? If it's a method, you're missing () there.
George Swan 20-Apr-15 1:38am    
Make sure you have the following using statement.
using System.Linq;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900