I have 2 datasets ds1 an开发者_如何学编程d ds2 ds1 contains valid values used in ds2 for e.g. ds1 contains subject table containing Maths, Science, History. ds2 contains Student table Student table contains Subject column. ds2->Student->Subject values should be present in ds->subject table.
How to implement this type of validation in effective way. I don't want to iterate through each row and column of student table.
e.g.
Students Table Name Subject Peter Maths George Science Joe IT Roger HistorySubjects Table
Subject Maths Science Maths HistoryNow I want to validate the data in Students Table against Subject table Check if the Subject is present in Subjects table or not. Here I want row Joe IT since IT is not present in Subjects table it is invalid.
Similarly , I need to check Students table data with multiple tables like Subjects.
I want LINQ query.
Use following query
var noSubject =
ds.Student.AsEnumerable().Where(s => ds.Subject.Rows.Find(s.Subject) == null);
精彩评论