4 years ago,
Your question has been submitted and is awaiting moderation.
In my database I have a foreign key field that is an integer and accepts nulls because in some situations the user can't provide a measurement. When I create a new record from DotNetNuke it throws an error about foreign key conflict because it saves it as 0 by default while there are no 0s in the lookup table. In my info class, I have changed the field type from int to int?
That solved my problem. However I come across another situation where I can retrieve records that have the foreign key set to null, but any records with a measurement value throws an error below when the stored procedure is executed:
A critical error has occurred. Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
Here is my property from the info class that stores the foreign key field:
private int? _EQSWLMeasurement
public int? EQSWLMeasurement
_EQSWLMeasurement = value;
Any idea how I can fix the issue, or is there anything obvious that I've missed out?