How can make it does not fails

hi

i am using this to filter as per condition

dt1 = dt.AsEnumerable.Where(Function (row) row(“Trxn_No”).ToString.StartsWith(“161”) or row(“Trxn_No”).ToString.StartsWith(“161P”) or row(“Trxn_No”).ToString.StartsWith(“161R”)).CopyToDataTable

i want make sure that it should not fail if there is no records

Hi,

How about the following?

arrDr = dt.AsEnumerable.Where(Function (row) row("Trxn_No").ToString.StartsWith("161") OrElse row("Trxn_No").ToString.StartsWith("161P") OrElse row("Trxn_No").ToString.StartsWith("161R")).ToArray()

note: arrDr is DataRow array type.

Regards,