日期:2014-05-20  浏览次数:20925 次

SubmitChanges未将对象引用设置到对象的实例
给位高手
            OutDetails outObj = new OutDetails();
            outObj.BillNo = obj.BillNo;
            outObj.DetailCount = obj.DetailCount;
            outObj.DetailNo = obj.DetailNo;
            outObj.MaterialName = obj.MaterialName;
            ctx.OutDetails.InsertOnSubmit(obj);
            ctx.SubmitChanges();
然后提交的时候报,未将对象引用设置到对象的实例。
请问是什么错误啊?

   在 System.Data.Linq.ChangeTracker.StandardChangeTracker.IsFastTracked(Object obj)
   在 System.Data.Linq.ChangeTracker.StandardChangeTracker.GetTrackedObject(Object obj)
   在 System.Data.Linq.ChangeProcessor.TrackUntrackedObjects(MetaType type, Object item, Dictionary`2 visited)
   在 System.Data.Linq.ChangeProcessor.TrackUntrackedObjects(MetaType type, Object item, Dictionary`2 visited)
   在 System.Data.Linq.ChangeProcessor.TrackUntrackedObjects()
   在 System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
   在 System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
   在 System.Data.Linq.DataContext.SubmitChanges()
   在 LinqBLL.OutDetailsObject.Save(OutDetails obj) 位置 D:\Learnning\CS\LinqDemo\LinqDemo\OutDetailsObject.cs:行号 43
   在 LinqBLL.OutBillObject.Save(OutBillObject obj) 位置 D:\Learnning\CS\LinqDemo\LinqDemo\OutBillObject.cs:行号 60
   在 Demo.Add.button1_Click(Object sender, EventArgs e)
   在 System.Windows.Forms.Control.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
   在 System.Windows.Forms.Button.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.RunDialog(Form form)
   在 System.Windows.Forms.Form.ShowDialog(IWin32Window owner)