Hi all,
I am trying to create a data validation rule where the values are of the type string, and if the values do not match the given option, it updates the database field with the appropriate message:
Any suggestions on what I have below (or perhaps something else)?
public static void Validate()
{
using (var stageContext = new StagingTableDataContext())
{
var data = stageContext.ProjectMasters;
foreach (var sourceDataEntry in data)
if (sourceDataEntry.Finance_Project_Region != "Gauteng") ||
(sourceDataEntry.Finance_Project_Region != "Free State") ||(sourceDataEntry.Finance_Project_Region != "Limpopo") ||(sourceDataEntry.Finance_Project_Region != "Kwazulu Natal") ||(sourceDataEntry.Finance_Project_Region != "Western Cape");
{
sourceDataEntry.Processing_Result = 2;sourceDataEntry.Processing_Result_Text = "Incorrect Province";sourceDataEntry.Processed_Datetime = DateTime.Now;
}
stageContext.SubmitChanges();
}
}
Thank you in advance!
Manas MohapatraRank #182 · 13.2K reputationPosted Jan 18, 2016, 12:07 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Jan 17, 2016, 11:30 PM EST
onmyway365 .45 reputationPosted Jan 17, 2016, 11:37 PM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Jan 17, 2016, 11:07 PM EST
onmyway365 .45 reputationPosted Jan 17, 2016, 11:20 PM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Jan 17, 2016, 11:57 PM EST
onmyway365 .45 reputationPosted Jan 17, 2016, 11:59 PM EST
onmyway365 .45 reputationPosted Jan 18, 2016, 1:02 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Jan 18, 2016, 2:35 AM EST
onmyway365 .45 reputationPosted Jan 18, 2016, 2:40 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts