if (insuredIdNoArg.HasValue) { var x = Convert.ToDecimal(InsuredMasterFields.Id); if (insuredIdNoArg == Convert.ToDecimal(InsuredMasterFields.Id)) { bucketPrimary.PredicateExpression.Add(InsuredMasterFields.Id == insuredIdNoArg); bucketDep.PredicateExpression.Add(InsuredMasterFields.Id == insuredIdNoArg); } else { bucketPrimary.PredicateExpression.Add(InsuredMasterFields.ExternalId == insuredIdNoArg); bucketDep.PredicateExpression.Add(InsuredMasterFields.ExternalId == insuredIdNoArg); }
insuredIdNoArg is the value I'm getting from the text box as input. InsuredMasterFields.Id is the value I'm getting from the database. When I try to compare both the values, I get the Invalid cast exception.
If (car)pieceofcheese == mycar
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)