Change LinkType and PageShortcutLink programmatically

Trying to change multiple pages to fetch data from a specified page by setting LinkType and PageShortcutLink but it throws an exception. How am I supposed to do it?


PageData page = DataFactory.Instance.GetPage(new PageReference(pageId));

page = page.CreateWritableClone();

page.LinkType = PageShortcutType.FetchData;
page.Property["PageShortcutLink"].Value = new PageReference(fetchId);

DataFactory.Instance.Save(page, EPiServer.DataAccess.SaveAction.Publish);
Throws: The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_tblWorkPage_tblPage1". The conflict occurred in database "EPiServerTest", table "dbo.tblPage", column 'pkID'. 


Jan 15, 2009 11:40
Worked when i came back from lunch, strange...
Jan 15, 2009 13:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.