gpt4 book ai didi

sql-server - BLToolKit 保存 null 而不是 0

转载 作者:太空宇宙 更新时间:2023-11-03 15:38:34 24 4
gpt4 key购买 nike

(不能用作标签,但我们使用 BLToolkit 作为 ORM)

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

如果你看图片,这就是我要保存的值。 (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

最佳答案

您是否考虑过为相关字段设置默认约束值 0?

关于sql-server - BLToolKit 保存 null 而不是 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30988152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com