我有一个incident表,incidentTypeId(int)它是一个允许 null 的外键。
该incidentType表有两列Id auto increment primary key not null和incidentType not null nvarchar。
该incidentType表用于填充一个DDL我有一个listItem被选为selected“”的值。我正在检查值是否为“”,如果是,我将我的设置selectedValue为DDL空。
当我从DDL一切都很好并且工作正常时,我选择了一些东西。
当我尝试并且insert没有选择任何内容并将其设置为时,我在不允许 null的列上null得到一个,因为它是主键。sqlexception on foreign key constraintincidentType Id
我怎样才能绕过允许空?