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!