(不能将其用作标记,但我们将BLToolkit用作ORM)
我有这个奇怪的问题,BLToolkit在我们的数据库中保存NULL而不是0。
如果您查看图像,这是我保存的值。 (gIdx代表GroupIndex)
以下是数据库中的结果。如果你查看GroupIndex列,我只有1和2.(这也适用于SortIndex列)
这是我的存储过程。该列只是一个NULL,INT
USE [ASTUSADMINISTRATION]
GO
/****** Object: StoredProcedure [dbo].[stpr_GridColumnLayout_Update] Script Date: 2015-06-22 08:08:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[stpr_GridColumnLayout_Update]
@ID AS [usrID],
@Width AS int,
@Index AS int,
@IsCellMerged AS [usrBoolean],
@GroupIndex AS int,
@SortIndex AS int,
@SortDirectionType AS int,
@SummaryItemType AS int,
@UpdatedDate AS datetime OUTPUT,
@UpdatedUser AS [usrUsername]
AS
BEGIN
SET NOCOUNT ON
SET @UpdatedDate = GETDATE()
-- Vérifier si c'est un groupe système
UPDATE [dbo].[GridColumnLayout] SET
[Width] = @Width,
[Index] = @Index,
[IsCellMerged] = @IsCellMerged,
[GroupIndex] = @GroupIndex,
[SortIndex] = @SortIndex,
[SortDirectionType] = @SortDirectionType,
[SummaryItemType] = @SummaryItemType,
[UpdatedDate] = @UpdatedDate,
[UpdatedUser] = @UpdatedUser
WHERE [GridColumnLayoutID] = @ID
END
答案 0 :(得分:0)
您是否考虑过为相关字段设置默认约束值为0?