From 22c0b1f1535e74491056f15ec8a53677b6241f19 Mon Sep 17 00:00:00 2001 From: nugroho Date: Tue, 20 May 2025 02:42:39 +0700 Subject: [PATCH] Late-revision: ValueKind.Null check instead of DBNull string literals --- APIHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/APIHandler.cs b/APIHandler.cs index bc68f22..464a742 100644 --- a/APIHandler.cs +++ b/APIHandler.cs @@ -199,7 +199,7 @@ public static partial class APIHandler CommandBuilder.Append("UPDATE agents SET"); foreach (JsonProperty Prop in UpdateFields.EnumerateObject()) { - Comm.Parameters.AddWithValue($"@p{Prop.Name}", Prop.Value.ValueKind == JsonValueKind.String ? Prop.Value.GetString() == "DBNull" ? DBNull.Value : Prop.Value.GetString() : Prop.Value.GetInt16()); + Comm.Parameters.AddWithValue($"@p{Prop.Name}", Prop.Value.ValueKind == JsonValueKind.Null ? DBNull.Value : Prop.Value.ValueKind == JsonValueKind.String ? Prop.Value.GetString() : Prop.Value.GetInt16()); CommandBuilder.Append($" [{Prop.Name}] = @p{Prop.Name},"); } Comm.Parameters.AddWithValue("@pagentid", AgentID);