How to check datatable exist

Hye. How can I check if certain datatable is exist or not. I’m trying to make so that the robot will scrap the data to make a new table if there are no datatable yet. If it already exist, it will skip that part.
Thanks.

1 Like

@Eizzuddin you can use “dt Is Nothing” in the if condition

1 Like

you can check something like the below statement in if condition

dt.Rows.Count==0

or

dt.Rows.Count>0

1 Like

@sudharani @Eizzuddin
If the dt doesn’t exists and you check dt.Rows.Count, it will through exception as dt object will not be assigned. Hence before checking row count, should check whether dt exists.
if(not dt is nothing) => for checking whether data table exists
if(not dt is nothing and dt.Rows.Count > 0) => to check is there any rows exists in the datatable.

Hope this is helpful!

4 Likes

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