So it happens when I first: read range from my Excel file and I’m 100% sure the data is there I checked.
After that I use:
dt = dt.AsEnumerable().GroupBy(Function(r) Tuple.Create(r.Field(Of String)(“1 of my col:”), r.Field(Of String)(“my second column”), r.Field(Of String)(“my third column”))).Where(Function(g) g.Count() = 1).Select(Function(g) g.First()).CopyToDataTable()
and I get an error: The source contains no data row.
Why so? there are rows there. It works sometimes but I don’t understand why sometimes it does not work.
Yes but how does it help? I understand how to use the try catch but I’m trying to understand why that error might be? Is it possible that the code deletes all the rows so this error occurs?
dt.AsEnumerable().GroupBy(Function(r) Tuple.Create(r.Field(Of String)(“1 of my col:”), r.Field(Of String)(“my second column”), r.Field(Of String)(“my third column”))).Where(Function(g) g.Count() = 1).Select(Function(g) g.First()).Any()
This will check if there is any rows first
If yes goes to then block where you can use a assign activity to get the records