Note that there are some explanatory texts on larger screens.

plurals
  1. PO"The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type."
    primarykey
    data
    text
    <p>I have a WCF service (services). The services manage the data. But now I have problems by selecting data in a LINQ-query. I get a message <strong>"The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type."</strong></p> <p>By debugging the first time I walk through the method you'll finish to the exception-line. When I put back the debugger line (the yellow marked one) onto line "// 08", and then I walk through the method everything goes fine.</p> <pre><code> private static ResultClass Geselecteerd(int AID_Artiest) // 01 { // 02 ResultClass _Result = new ResultClass(); // 03 string sMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;// 04 // 05 try // 06 { // 07 var recArtiest = (from artiest in DatabaseControl.GetDatabeheer.DataContext.ARTIESTs // 08 where artiest.ID_ARTIEST == AID_Artiest select artiest).SingleOrDefault(); if (recArtiest != null) { ArtiestDataType.ID_Artiest = recArtiest.ID_ARTIEST; ArtiestDataType.Artiestnaam = recArtiest.ARTIESTNAAM; ArtiestDataType.Voorvoegsel = recArtiest.VOORVOEGSEL; ArtiestDataType.Product = recArtiest.PRODUCT; ArtiestDataType.ID_Categorie = recArtiest.ID_CATEGORIE; ArtiestDataType.ID_Genre = recArtiest.ID_GENRE; ArtiestDataType.Is_Band = BasisDataType.GetBoolString(recArtiest.IS_BAND); ArtiestDataType.Land = recArtiest.LAND; ArtiestDataType.Plaats = recArtiest.PLAATS; ArtiestDataType.Website = recArtiest.WEBSITE; ArtiestDataType.DatumInvoer = recArtiest.DATUM_INVOER; ArtiestDataType.DatumMutatie = recArtiest.DATUM_MUTATIE; } } catch (Exception ex) { string sFoutmelding = "Kan geen selectie maken."; FLogboek.AddFoutmelding(FClassName, sMethodName, sFoutmelding, ex.Message); _Result.Code = ResultCode.FATAAL; _Result.Melding = sFoutmelding; } return _Result; } </code></pre> <p><strong>ID_ARTIEST is an integer field and it is a primary key too. The value of the field is required and a NULL-value is not possible.</strong></p> <p><strong>This method has always worked. The problem starts when I add new Service.</strong></p> <p>My question is: What do I wrong? Has is to do with the service? <strong>Do I have to delay the process?</strong> Can anybody give me some tips? I've 8 service references. If you're missing some essential sources, I can add it.</p> <p>I have now only a work-around. I have added try-catch inside the try-catch area. And then I didn't get any exception. It has to do with the performance. <strong>Do I need an Async-solution?</strong></p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload