views:

21

answers:

0

Hi,

I am unable to update the record in SharePoint 2010 using new linq feature. follwoing in my code please review it.

  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();
                  }