Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
GeneralRe: Best way to integrate PowerPoint or slideviewer in C# Pin
DaveyM6920-Mar-13 0:26
professionalDaveyM6920-Mar-13 0:26 
GeneralRe: Best way to integrate PowerPoint or slideviewer in C# Pin
Sachin k Rajput 20-Mar-13 1:26
Sachin k Rajput 20-Mar-13 1:26 
Questionhow to index all the data from disk Pin
Member 888804419-Mar-13 7:53
Member 888804419-Mar-13 7:53 
AnswerRe: Sir, Dan Letecky post Desktop Search Application: Part 2 Pin
Dave Kreskowiak19-Mar-13 8:12
mveDave Kreskowiak19-Mar-13 8:12 
QuestionMaintaining Variables Pin
clugsy6419-Mar-13 5:38
clugsy6419-Mar-13 5:38 
AnswerRe: Maintaining Variables Pin
NotPolitcallyCorrect19-Mar-13 5:39
NotPolitcallyCorrect19-Mar-13 5:39 
GeneralRe: Maintaining Variables Pin
clugsy6419-Mar-13 5:52
clugsy6419-Mar-13 5:52 
AnswerRe: Maintaining Variables Pin
Simon_Whale19-Mar-13 5:59
Simon_Whale19-Mar-13 5:59 
AnswerRe: Maintaining Variables Pin
Pete O'Hanlon19-Mar-13 6:07
mvePete O'Hanlon19-Mar-13 6:07 
GeneralRe: Maintaining Variables Pin
clugsy6419-Mar-13 7:20
clugsy6419-Mar-13 7:20 
AnswerRe: Maintaining Variables Pin
Abhinav S19-Mar-13 18:17
Abhinav S19-Mar-13 18:17 
Questionread .sav-file Pin
ANahr19-Mar-13 4:40
ANahr19-Mar-13 4:40 
AnswerRe: read .sav-file Pin
NotPolitcallyCorrect19-Mar-13 4:53
NotPolitcallyCorrect19-Mar-13 4:53 
AnswerRe: read .sav-file Pin
Jegan Thiyagesan19-Mar-13 6:10
Jegan Thiyagesan19-Mar-13 6:10 
GeneralRe: read .sav-file Pin
ANahr19-Mar-13 11:15
ANahr19-Mar-13 11:15 
AnswerRe: read .sav-file Pin
Pete O'Hanlon19-Mar-13 6:34
mvePete O'Hanlon19-Mar-13 6:34 
QuestionUsing URL in C# Pin
annex4518-Mar-13 21:21
annex4518-Mar-13 21:21 
AnswerRe: Using URL in C# PinPopular
Pete O'Hanlon18-Mar-13 23:12
mvePete O'Hanlon18-Mar-13 23:12 
AnswerRe: Using URL in C# Pin
Richard Deeming18-Mar-13 23:41
mveRichard Deeming18-Mar-13 23:41 
GeneralRe: Using URL in C# Pin
annex4520-Mar-13 12:43
annex4520-Mar-13 12:43 
AnswerRe: Using URL in C# Pin
jschell19-Mar-13 9:53
jschell19-Mar-13 9:53 
QuestionLinq To SQL Query Not Working - Null Problem Pin
Kevin Marois18-Mar-13 20:40
professionalKevin Marois18-Mar-13 20:40 
I have a query:

private IQueryable<MaterialModel> getMaterialQuery()
{
    var query = (from mh in DataContext.MaterialHeaders
                    join md in DataContext.MaterialDetails on mh.MaterialHeaderId equals md.MaterialId
                    select new MaterialModel
                    {
                        Id = md.MaterialDetailId,
                        MaterialHeaderId = mh.MaterialHeaderId,
                        MaterialDetailId = md.MaterialDetailId,
                        SafetyLabelTextId = mh.SafetyLabelTextId.Value,
                        MaterialTypeId = mh.MaterialTypeId,
                        IncludeInSolventProgram = mh.IncludeInSolventProgram.Value,
                        IsDamagedByFreezing = mh.IsDamagedByFreezing.Value,
                        IsEquipment = mh.IsEquipment.Value,
                        IsMSDS = mh.IsMSDS.Value,
                        IsPPE = mh.IsPPE.Value,
                        IsTDG = mh.IsTDG.Value,
                        IsMiscellanousCost = mh.IsMiscellanousCost.Value,
                        IsSolvent = mh.IsSolvent.Value,
                        ItemName = mh.ItemName,
                        ItemNumber = mh.ItemNumber,
                        ProductTypeId = mh.ProductTypeId,
                        ProductUsage1Id = mh.ProductUsage1Id.Value,
                        ProductUsage2Id = mh.ProductUsage2Id.Value,
                        ProductUsage3Id = mh.ProductUsage3Id.Value,
                        ProductUsage4Id = mh.ProductUsage4Id.Value,
                        SafetyLabelRequired = mh.SafetyLabelRequired.Value,
                        WarehouseLocationId = md.WarehouseLocationId.Value,
                        Color = md.Color,
                        DiamondGritId = md.DiamondGritId.Value,
                        IsActive = md.IsActive,
                        IsDiscontinued = md.IsDiscontinued.Value,
                        IsNormallyStocked = md.IsNormallyStocked.Value,
                        FittingId = md.FittingId,
                        ShowOnJobLists = md.ShowOnJobLists.Value,
                        MinimumOnHandQuantity = md.MinimumOnHandQuantity.Value,
                        MSDSDescription = md.MSDSDescription,
                        PhysicalCount = md.PhysicalCount.Value,
                        PhysicalCountDate = md.PhysicalCountDate.Value,
                        RackingLocation = md.RackingLocation,
                        RackingNumber = md.RackingNumber,
                        SizeId = md.SizeId
                    });

    return query;
} 


I then call it like this:

public MaterialModel GetDuplicateMaterial(NewMaterialInfoModel NewMaterialInfoEntity)
{
    var query = getMaterialQuery();
    MaterialModel entity = query.Where(e => e.ItemName == NewMaterialInfoEntity.ItemName &&
                                            e.MaterialTypeId == (int)NewMaterialInfoEntity.MaterialType &&
                                            e.SizeId == NewMaterialInfoEntity.SizeId &&
                                            e.Color == NewMaterialInfoEntity.Color).FirstOrDefault();
    return entity;
}


On the NewMaterialInfoEntity the Color property is empty, and there is a null in the Color column of the table. Yet this fails to return the entity.

What am I doing wrong here?

Thanks
If it's not broken, fix it until it is

AnswerRe: Linq To SQL Query Not Working - Null Problem Pin
Freak3019-Mar-13 0:25
Freak3019-Mar-13 0:25 
GeneralRe: Linq To SQL Query Not Working - Null Problem Pin
Kevin Marois19-Mar-13 5:00
professionalKevin Marois19-Mar-13 5:00 
AnswerRe: Linq To SQL Query Not Working - Null Problem Pin
Mycroft Holmes19-Mar-13 0:28
professionalMycroft Holmes19-Mar-13 0:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.