SubmitChanges() 抛出内部服务器错误

SubmitChanges() throws internal server error

public void RejectOrder(string rejectReason, int selectedNewOrderId)
    {
        SFNewOrder sfNewOrder = mdbDataContext.SFNewOrders.FirstOrDefault(x => x.ID == selectedNewOrderId && !x.IsRejected);

        if (sfNewOrder != null)
        {
            sfNewOrder.IsRejected = true;                              
        }

        SFReject sfReject = new SFReject();

        sfReject.SFNewOrderID = sfNewOrder.ID;
        sfReject.RejectReason = rejectReason;
        sfReject.RejectedDate = DateTime.Now;           
        sfReject.RejectedBy = 2;

        mdbDataContext.SFRejects.InsertOnSubmit(sfReject);
        mdbDataContext.SubmitChanges();
    }

这里我想在 SFNewOrder Table 中更改 IsRejected 属性 并在 SFReject Table 中插入一条新记录。但我越来越

internal server error

...上

mdbDataContext.submitchanges();

请帮忙...提前致谢。

public void RejectOrder(string rejectReason, int selectedNewOrderId, User user)
{
    SFNewOrder sfNewOrder = mdbDataContext.SFNewOrders.FirstOrDefault(x => x.ID == selectedNewOrderId && !x.IsRejected);

    if (sfNewOrder != null)
    {
        sfNewOrder.IsRejected = true;                              
    }

    SFReject sfReject = new SFReject();

    sfReject.SFNewOrder = sfNewOrder; 
    sfReject.RejectReason = rejectReason;
    sfReject.RejectedDate = DateTime.Now;           
    sfReject.User= user;

    mdbDataContext.SFRejects.InsertOnSubmit(sfReject);
    mdbDataContext.SubmitChanges();
}

因为我在 SFReject table 中有 2 个外键,所以我需要分配 table 的整个对象。 它的工作:)