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

by pietman 13. November 2009 15:51

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.

 

 

Tags:

LINQ | SQL SERVER

are you sure

by pietman 29. May 2009 13:43

add the following attributes:

OnClientClick="if(!confirm('Are you sure?'))return false;"

to your button / link button etc. e.g.

<asp:LinkButton ID="ButtonReset" runat="server" Text="Reset"

onclick="ButtonReset_Click" OnClientClick="if(!confirm('Are you sure?'))return false;" />

 

Tags:

CSS | LINQ

making checkbox/check box READONLY

by pietman 12. May 2009 16:41

The easiest work around I guess is to do a javascript return false on trying to change the value, thus:

onclick="return false;"

Here are the ASP.Net and HTML versions:

<asp:CheckBox ID="Whatever" runat="server" onclick="return false;" />

<input type="checkbox" onclick="return false;" />

Tags:

c# | CSS | LINQ

About ...

pietman celliersPietman Celliers
Bitlink  Ltd
bitlinkit.com