Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if no datarows returned

I have this which check for datarows which match an expression:

DataRow[] foundRows = this.callsTable.Select(searchExpression);

How do i check if it returns some datarows, so basically if it returns none don't do what's in the if function?

I have tried:

if (foundRows != null) { }
like image 859
RSM Avatar asked Dec 26 '22 16:12

RSM


1 Answers

You can use the Length property of array to check if you get any rows

if (foundRows.Length == 0) 
like image 172
Adil Avatar answered Jan 01 '23 23:01

Adil