We are experiencing issues across various tables, with different fields, where randomly the value 2024 is being recorded in the column when passing the parameter as shown below. This occurs only when the instruction "IIf(iAnyID2 = 0, DBNull.Value, iAnyID2)" is used, even though the value of the property iAnyID2 is zero by default and the value is not assigned anywhere.
myCmd.Parameters.AddWithValue("@AnyID2", IIf(iAnyID2 = 0, DBNull.Value, iAnyID2))
It does not always record the value 2024; sometimes it correctly records NULL.
myCmd.Parameters.AddWithValue("@AnyID2", IIf(iAnyID2 = 0, DBNull.Value, iAnyID2))
It does not always record the value 2024; sometimes it correctly records NULL.