fparadis (1) [Avatar] Offline
#1
I am trying to update an attrubute with a null value (nullable) . The code work at runtime, but the action is not reflected on SQL Server 2000. . I am a beginner , so i am not sure of what i am doing wrong.

Here is the code :

(Check for the attribute "IntermediaireReferenceNiveau1")


using (Linq.RetributionAuxIntermediairesDataClassesDataContext
ctx = new Linq.RetributionAuxIntermediairesDataClassesDataContext(Facade.Retribution.ConnectionStringRetribution,
Facade.Retribution.RetributionLinqMappings))
{
Linq.Compte linqCompte = new Linq.Compte();
linqCompte.Id = unCompte.Id;
linqCompte.TimeStamp = unCompte.Timestamp.StringToTimestamp();
linqCompte.SystemeIdentificationCompte = unCompte.SystemeIdentification;
ctx.Comptes.Attach(linqCompte);

linqCompte.IndicateurProtectionDonneeNominative = Convert.ToChar(unCompte.IndicateurProtectionDonneeNominative);
if (unCompte.IntermediaireReferenceNiveau1 == null)
{
linqCompte.IntermediaireReferenceNiveau1 = null;
}
else
{
linqCompte.IntermediaireReferenceNiveau1 = unCompte.IntermediaireReferenceNiveau1.Id;
}

if (unCompte.IntermediaireReferenceNiveau2 == null)
{
linqCompte.IntermediaireReferenceNiveau2 = null;
}
else
{
linqCompte.IntermediaireReferenceNiveau2 = unCompte.IntermediaireReferenceNiveau2.Id;
}

ctx.SubmitChanges();