[英]How can I update the record in sharepoint 2010 using linq
我無法使用新的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();
}
完全不需要。 ctx.Holidays.Attach(Holidayobj);
ctx.SubmitChanges(); 是你所需要的全部
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.