am getting this error once i try to update a bit field with null. please note that technically the bit is set to ‘allow null’.
am getting this error :
‘Object of type ‘System.DBNull’ cannot be converted to type ‘System.Nullable`
When I do this :
e.NewValues.Add("IdleBlock", DBNull.Value);
Try using an actual
nullinstead ofDBNull.Value. As you can see in the error message it’s trying to convert the latter into anull, so I’m guessing EF wants a proper null value and handle conversion on it’s own.Edit: Err, actually I think I’m wrong here. It wants a
System.Nullablenot a null. Try passing it a new System.Nullable withValueset tonull?