Here I have a datatable named ReportDT and have 2 string variable values.
Variable names are var1, var2
I need to get the row index of ReportDT where the first column value matches with var1 and second column value matches var2.
For this I have tried the following expression
ReportDT.Rows.IndexOf(ReportDT.AsEnumerable.Where(Function(r) r(“Candidate_Number_from_Reference_Excel”).ToString=var1 AndAlso r(“Centre_Number”).ToString = var2.FirstOrDefault)
but when I tried this expression, I’m getting an error like the below one
this is my correct expression:
ReportDT.Rows.IndexOf(ReportDT.AsEnumerable.Where(Function(r) r(“Candidate_Number_from_Reference_Excel”).ToString=CurrentRow.Item(4).ToString AndAlso r(“Centre_Number”).ToString = CurrentRow.Item(2).ToString).FirstOrDefault)