How to insert NULL Guid field?
Posted: Sun 07 Feb 2016 13:00
Hey
I use Entity Framework and I my tables are defined with Guid as Id field.
Now, I have in one table a Guid field, which is related to an other table, which can be 0 or one.
When I try to insert an empty field like:
The field get's a value of '00000000-0000-0000-0000-000000000000'
(Which is specific for Guid.Empty)
The Problem is, that I get an Foreign Key Error, because in the related table, there is no GUID record, which has this value (of Course there is no one)
But, how can I set this field to NULL?
THX
I use Entity Framework and I my tables are defined with Guid as Id field.
Now, I have in one table a Guid field, which is related to an other table, which can be 0 or one.
When I try to insert an empty field like:
Code: Select all
Table.GuidField = Guid.Empty
' Or
Table.GuidField = Nothing
(Which is specific for Guid.Empty)
The Problem is, that I get an Foreign Key Error, because in the related table, there is no GUID record, which has this value (of Course there is no one)
But, how can I set this field to NULL?
THX