BLToolKit保存null而不是0

时间:2015-06-22 12:12:09

标签: c# sql-server database stored-procedures bltoolkit

我有这个奇怪的问题,BLToolkit在我们的数据库中保存NULL而不是0。

Demo to reproduce the bug

如果您查看图像,这是我保存的值。 (gIdx代表GroupIndex) Values when the Stored Procedure is being executed

以下是数据库中的结果。如果你查看GroupIndex列,我只有1和2.(这也适用于SortIndex列) enter image description here

这是我的存储过程。该列只是一个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

字符串也会发生类似的问题。只保存1个字符。 (more detail here

1 个答案:

答案 0 :(得分:0)

该错误已于2015年7月27日修复

这实际上是使用存储过程插入数据库时​​使用ExecuteForEach方法时BLToolkit的错误。

See the issue on the GitHub project