Error: The source contains no data rows

Hi everyone. I am trying to cater for exception situation where there is no record retrieve. I write the expression: Master_DT.AsEnumerable().Where(Function(row) row(“Email”).ToString=item(“Email”).ToString).CopyToDataTable() in the Statement Sequence Activity inside the Try Catch Sequence Activity.

I have encountered this error while I was debugging the file. It shows "Assign check email existence and assign result to database. The source contains no DataRows"

*I am trying to cater for exception situation where there is no record retrieve from the Excel file.

Hi @mosyahri,

This refers for the condition you are checking in your data, no such rows are found which contain the expression you gave gets satisfied. The email text you provide does not match with the already present data.

Hello @mosyahri,

For this you can check if it contains any row before copying to datatale
using this in IF condition use .ToList.Count
and than use .CopyToDataTable
Please find the screenshot for your further reference.

Capture

Now the error says "If: Object reference not set to an instance of an object"

Ok. Then how to write the script?