I have this weird problem where BLToolkit saves NULL instead of 0 in our database.
If you look the image, this is my values that will be saved. (gIdx stand for GroupIndex)
Here are the results in the database. If you look at the GroupIndex Column, i only have 1 and 2. (this thing happen also for the SortIndex column)
this is my stored proc. And the column is simply a 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
Similar issue happens with a string. Only 1 character is saved. ( more detail here )
The bug has been fix on July, 27th 2015
This is actually a bug of BLToolkit when using the
ExecuteForEach
method when inserting into a Database using a Stored Procedure.See the issue on the GitHub project