无法将值NULL插入“DeletedDatabaseRecord”列,...;列不允许空值。 INSERT失败

时间:2016-06-24 07:59:19

标签: acumatica

检查添加的字段并保存

时出现此错误

“无法将值NULL插入列'DeletedDatabaseRecord',表'...';列不允许空值.INSERT失败

声明已被终止“

这是我的扩展表的创建语句

CREATE TABLE [dbo].[RQRequestTableExtension]
(
    [CompanyID] [int] NOT NULL,
    [OrderNbr] [int] NOT NULL,
    [BranchID] [int] NOT NULL,
    [DeletedDatabaseRecord] [bit] NOT NULL,
    [AdminApproval] [Bit],
    CONSTRAINT [RQRequestTableExtension_PK] PRIMARY KEY CLUSTERED
    (
    [CompanyID] ASC,
    [OrderNbr] ASC,
    [BranchID] ASC

)
WITH (PAD_INDEX = OFF,
STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE [dbo].[RQRequestTableExtension] ADD DEFAULT ((0))
FOR [DeletedDatabaseRecord]
GO

这是我的DAC扩展

namespace PurchaseRequisitionApproveButton
{
    [PXTable(typeof(RQRequest.orderNbr), typeof(RQRequest.branchID),
IsOptional = true)]
    public class RQRequestTableExtension : PXCacheExtension<RQRequest>
    {
        [PXDBBool]
        [PXUIField(DisplayName = "Admin Approval", Visibility = PXUIVisibility.Visible)]
        public bool? AdminApproval { get; set; }
    }
}

1 个答案:

答案 0 :(得分:1)

您的PXTable属性错误。这是我宣布我的方式(不使用Optional)。您不需要BranchID

    [PXTable(typeof(RQRequest.orderNbr))]
    public class RQRequestExtension : PXCacheExtension<RQRequest>

此外,您无需添加DeletedDatabaseRecord字段。它不包含在原始表中。