.

The null value cannot be assigned to a member with type System.Guid which is a non-nullable value type

I encountered the following issue and couldn't find any information on the internet on this issue:

The null value cannot be assigned to a member with type System.Guid which
is a non-nullable value type.

Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.

Exception Details:
System.InvalidOperationException: The null value cannot be assigned to a
member with type System.Guid which is a non-nullable value
type.

Source Error:

Line 1690: Kingsweb2DataAccess.Kingsweb2DataClassesDataContext newdb = new Kingsweb2DataAccess.Kingsweb2DataClassesDataContext();

Line 1691: List<Kingsweb2DataAccess.SearchKingsFullListResult> x = (from m in newdb.SearchKingsFullList(KingsHospitalID) select m).ToList();

Line 1692: foreach (string word in words)

After quite a struggle I solved it as follow (which really is bizarre and still unexplained):

 I change:

SELECT *, guidanceType.name as guidanceType, legacyID as refid
FROM  HospitalGuide INNER JOIN
               GuidanceType ON HospitalGuide.GuidanceTypeId = GuidanceType.Id

 To:

SELECT HospitalGuide.*, guidanceType.name as guidanceType, legacyID as refid
FROM  HospitalGuide INNER JOIN
               GuidanceType ON HospitalGuide.GuidanceTypeId = GuidanceType.Id

 and it solved my problem.

 

 

What's your thoughts on this?

*

Protected by WP Anti Spam