Datatable object reference

Basically here I need to get the count of data table to a variable but in cases where data table is empty , I need notifications but I am getting an error

Hi @Nancy_Star

So basically to get the count and avoid that error

Better check the count in if condition and then assign it to a variable

Example

In if condition
Expression : DT.rows.count>0

Then. Use your variable and assign the value accordingly

Else datatable is empty,send out notification

Also please intialize your datatable

1 Like

Hi @Nancy_Star,

If you have created object for the datatable only need to check the row count use below one
Dt.Rows.Count>0

If suppose datatable object created or not check use below one

IsNothing(dt)

Regards,
Arivu

2 Likes

Condition for empty dt or dt with 0 rows:

Dt isNot Nothing AndAlso dt.RowCount>0

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