Null or DataTable?

Hello everyone!

I have a linQ code which i want to assign to a variable.

(From web_row In web_dt.AsEnumerable()
    Where Not excel_dt.AsEnumerable().Any(Function(local_row) local_row.Field(Of String)("Посилання") = web_row.Field(Of String)("Посилання"))
    Select web_row

The thing is this code can give me back either null or datatable, depends on the result.

So my question is - can i create a variable, that can be assigned either null or datatable depending on linQ result?

For now i am using the try/cath to cath when its null and then do something in the catch block, but i think there is better way, is it?

Have you checked out 🚑 🆘 [FirstAid] Handling of The source contains no DataRows exception

no, but i will try now

thanks, it worked!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.