SetSourceCriteria paging error


I use SetSourceCriteria having a page size but I get a

Dataset returned invalid RecordCount: -1 when the records on the database table is bigger that then page size.

Why is that behavior?


That's expected, as not all records were retrieved, the RecordCount value would not be reliable. If you want to know the real record count in database before all pages are retrieved, an extra SQL execution is needed to retrieve such number of records. 

You should set RecordCountMode to Retrieve. Check here: