If DT1 Is Nothing OrElse DT2 Is Nothing Then
' Your THEN block workflow here
LogMessage("Either DT1 or DT2 is null.")
Else
' Your ELSE block workflow here
LogMessage("Both DT1 and DT2 are not null.")
End If
If
IsNothing(DT1) OrElse IsNothing(DT2) OrElse IsNothing(DT1) AndAlso IsNothing(DT2)
Then
' THEN workflow
' This block will execute if either DT1 or DT2 is null, or both DT1 and DT2 are null, or dt is null or contains only null or empty values
Else
' ELSE workflow
' This block will execute if none of the above conditions are met
End If
If (DT1 Is Nothing OrElse DT1.Rows.Count = 0) AndAlso (DT2 Is Nothing OrElse DT2.Rows.Count = 0) Then
' Your THEN block workflow here
LogMessage("Either DT1 or DT2 has headers but no data.")
Else
' Your ELSE block workflow here
LogMessage("Both DT1 and DT2 have data or do not have headers.")
End If
Yes, your understanding is correct. If the DataTables always contain headers and you want to check if they have no data, you can use DT1.Rows.Count = 0 OrElse DT2.Rows.Count = 0 in your condition.
If DT1.Rows.Count = 0 OrElse DT2.Rows.Count = 0 Then
' Your THEN block workflow here
LogMessage("Datatables have no data.")
Else
' Your ELSE block workflow here
LogMessage("At least one of the Datatables has data.")
End If
This condition checks if either DT1 or DT2 has no rows (no data) and will execute the THEN block if at least one of them has no data. If both DataTables have data or at least one of them has data, it will execute the ELSE block.