2010-07-22 49 views
0

我無法使用新的linq功能更新SharePoint 2010中的記錄。 在我的代碼中翻閱請檢查它。如何使用linq更新Sharepoint 2010中的記錄

AbsentTrackingSystemEntitiesDataContext ctx = new AbsentTrackingSystemEntitiesDataContext(spWeb.Url); 
       ctx.ObjectTrackingEnabled = true; 
       HolidaysItem Holidayobj = GetHolidays(HolidayID, ctx); // get the specific record to be update. 
       if (Holidayobj != null) 
       { 
        Holidayobj.Title = "test"; 
        Holidayobj.HolidayDate = DateTime.Today; 
        Holidayobj.Description = "test holiday"; 
        ctx.Holidays.Attach(Holidayobj); 
        // or ctx.Holidays.Attach(Holidayobj, true); not working in 2010 
        ctx.SubmitChanges(); 
        } 

回答

0

這根本不是必需的。 ctx.Holidays.Attach(Holidayobj);

ctx.SubmitChanges();是你需要的全部