How to handle 0 in row.count function

hi
i using this code to get count of rows .but if its 0 i m getting error i can use a if activity i want to know a way to handle it its in the code here

DataTableVariable.AsEnumerable.Where(Function(r) Convert.ToString(r(“IsStudent”)).Equals(“TRUE”)).CopyToDataTable.Rows.Count

Thank you

Hi,

Basically we need to avoid to use CopyDataTable method if there is no DataRow, as the following steps, for example

rows = DataTableVariable.AsEnumerable.Where(Function(r) Convert.ToString(r("IsStudent")).Equals("TRUE"))

Then use CopyToDataTable if rows.Count is one or more. (Use if activity or if operator etc)

Note: The above rows is IEnumerable<DataRow> type

Regards,

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